Problem beim loginmenü

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

HartlMax

Betreff: Problem beim loginmenü

BeitragSo, Nov 23, 2008 14:28
Antworten mit Zitat
Benutzer-Profile anzeigen
HI @ all ich beobachte das Forum schon länger und habe dies und das schonmal ausprobiert! Jetzt bin ich an einer stelle gelangt wo ich nicht weiterkomme! Habe schon die Sufu benutzt und gegoogelt!

Mein Problem ist das ich bei meinem Loginmenü das ich geprogt habe nicht das Passwort bereich auswählen kann!

hier einmal wie mein loginmenü aussieht

user posted image

und einmal der code!
Code: [AUSKLAPPEN]

Graphics 640,480,32,2
SetBuffer BackBuffer ()

AppTitle "?"

Color 0, 0, 255
Global font = LoadFont ("Verdana",20,1)
SetFont font

HidePointer

login = LoadImage ("data/gfx/loginmenue.png")
loginpass = LoadImage ("data/gfx/loginpass.png")
loginname = LoadImage ("data/gfx/loginname.png")
mouse = LoadImage ("data/gfx/mouse.png")

MaskImage loginpass, 0, 255, 0
MaskImage loginname, 0, 255, 0
MaskImage mouse, 0, 255, 0

While Not KeyHit (1)
   Cls
   
   DrawImage login, 0, 0
   DrawImage loginpass, 0, 0
   DrawImage loginname, 0, 0
   DrawImage mouse,MouseX,MouseY
   
      If ImagesOverlap (loginname, 0, 0, mouse, 0, 0) And MouseHit (1) Then
         Locate 230, 204
         accname$ = Input ("")
         
         If accname$ = ("") Then
            Locate 230, 204
            Print accname$
         EndIf         
      EndIf
      
      If ImagesOverlap (loginpass, 0, 0, mouse, 0, 0) And MouseHit (1) Then
         Locate 230, 269
         Passwort$ = Input ("")
         
         If Passwort$ = ("") Then
            Locate 230, 269
            Print Passwort$
         EndIf         
      EndIf
   
   Flip
Wend

End


Wenn noch irgendwelche Fehler drin sind die ich nicht gefunden habe dann immer her damit! Razz
www.hartl-bros.de

Xeres

Moderator

BeitragSo, Nov 23, 2008 15:09
Antworten mit Zitat
Benutzer-Profile anzeigen
Liegt am Mousehit(1)-> Wie kann ich Mausklicks richtig abfragen ?
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus
T
HERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld)

Rallimen

Sieger des 30-EUR-Wettbewerbs

BeitragSo, Nov 23, 2008 15:09
Antworten mit Zitat
Benutzer-Profile anzeigen
Hier beim überfliegen gefunden Code: [AUSKLAPPEN]
Graphics 640,480,32,2
SetBuffer BackBuffer ()

AppTitle "?"

Color 0, 0, 255
Global font = LoadFont ("Verdana",20,1)
SetFont font

HidePointer

login = LoadImage ("data/gfx/loginmenue.png")
loginpass = LoadImage ("data/gfx/loginpass.png")
loginname = LoadImage ("data/gfx/loginname.png")
mouse = LoadImage ("data/gfx/mouse.png")

MaskImage loginpass, 0, 255, 0
MaskImage loginname, 0, 255, 0
MaskImage mouse, 0, 255, 0

While Not KeyHit (1)
   Cls
   
   DrawImage login, 0, 0
   DrawImage loginpass, 0, 0
   DrawImage loginname, 0, 0
   DrawImage mouse,MouseX(),MouseY();klammern vergessen
   If MouseHit (1) Then ;MouseHit pro schleifen durchgang nur einmal abfragen
   ;oder in einer Variablen abspeichern
      If ImagesOverlap (loginname, 0, 0, mouse, MouseX(),MouseY())  Then ; immer position 0,0 abfragen macht kein Sinn
         Locate 230, 204
         accname$ = Input ("")
         
         If accname$ = ("") Then
            Locate 230, 204
            Print accname$
         EndIf         
      EndIf
     
      If ImagesOverlap (loginpass, 0, 0, mouse, MouseX(), MouseY())  Then
         Locate 230, 269
         Passwort$ = Input ("")
         
         If Passwort$ = ("") Then
            Locate 230, 269
            Print Passwort$
         EndIf         
      EndIf
   EndIf
   Flip
Wend

End


deine bilde auf 0,0 Position ist auch nicht so richtig da alle übereinander liegen
so ich muß jetzt weg....
[BB2D | BB3D | BB+]

ozzi789

BeitragSo, Nov 23, 2008 15:23
Antworten mit Zitat
Benutzer-Profile anzeigen
Was falsch drann ist
1. Input
2. Mousehit abfrage(wie schon erwähnt)

BSP.
So sollte es etwa aussehn, ned Grafisch sondern von der Technik Smile
Drück auf die weissen Buttons um dein Benutzernamen einzugeben.
(Setz für hidepwd eine 1 wenn du willst das das Passwort nur in form von *** kommt)


Code: [AUSKLAPPEN]
Graphics 640,480,32,2
apptitle "?"
Global antwort$,backtime = MilliSecs(),ccolor,pwdeingeben,hidepwd
SetBuffer BackBuffer()
name_x=200
name_y=200
pwd_x=200
pwd_y=300
 

 hidepwd=1 ; Wenn 1 dann Passwort nur in Sternchen zeigen


While Not KeyHit(1)
Cls

mausx=MouseX()
mausy=MouseY()
maus=GetMouse()

If mausx>name_x And mausx < name_x+30 And mausy>name_y And mausy<name_y+30 And maus=1
    If pwdeingeben=0
      antwort$=""
      nameneingeben=1
    EndIf
FlushKeys
EndIf

If mausx>pwd_x And mausx < pwd_x+30 And mausy>pwd_y And mausy<pwd_y+30 And maus=1
    If nameneingeben=0
      antwort$=""
      pwdeingeben=1
    EndIf
FlushKeys
EndIf

If nameneingeben=1
login_name$ = newinput$(300,200,300,200,">>", 10)
EndIf

If pwdeingeben=1
login_pwd$ = newinput$(300,300,300,200,">>", 10)
EndIf

If KeyHit(28) nameneingeben=0:pwdeingeben=0

Rect name_x,name_y,30,30
Rect pwd_x,pwd_y,30,30

Text 160,200,"Name"
Text 130,300,"Passwort"
Text 260,200,login_name$

If hidepwd=0
    Text 260,300,login_pwd$
      Else
   Text 260,300,String("*",Len(login_pwd$))
EndIf

Flip
Wend
End


Function newinput$(x1,y1,x2,y2,frage$,maxl)
   a = GetKey()
   If a => 32 And a <= 255 And Len(antwort$) <= maxl-1 Then antwort$ = antwort$ + Chr$(a)
   If KeyDown(28)
 
 Return antwort$
EndIf
   If KeyDown(14) Or KeyDown(203) And Len(antwort$) > 0 And MilliSecs()-backtime > 125 Then
      antwort$ = Left(antwort$,(Len(antwort$)-1))
      backtime = MilliSecs()
   End If

   textlange = StringWidth(antwort$) ;Blinkener Cursor
   texthohe = StringHeight(antwort$)
   fragelange = StringWidth(frage$)
   Color 0,50,ccolor
   Rect x1+28+(Len(antwort$)*8),y1+4,10,texthohe-1,1
   ccolor = ccolor + 5
   If ccolor = 255 Then ccolor = 100
   Color 255,255,255
   If pwdeingeben=1 And hidepwd=1
      Text x1+3,y1+3, frage$ + " " + String("*",Len(antwort$))
   Else
    Text x1+3,y1+3, frage$ + " " + antwort$
   EndIf
End Function


Die eingabe Routine ist von Triton Wink
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group