Dropdown für BB von ???
Dies sind 2 functionen, zum erstellen von simplen dropdownboxes.

Hier erstmal die dokumentation:

[code:1:a058f0d334][b] dropdown (id%[,x%,y%,width%,bgrndr%,bgrndg%,bgrndb%,colorr%,colorg%,colorb%,downcr%,downcg%,downcb%])[/b]

Definition:
Erstelle eine Dropdown box. Die id muss angegeben werden. dropdown sollte in jedem frame neu gezeichnet werden. Beachte, dass man den Inhalt vorher ueber Load_Dropdowns laden muss.

Parameter Beschreibung:
id% = handle des Dropdowns
[AB HIER ALLE OPTIONAL]
x% = x koordinate
y% = y koordinate
width% = Gesammtbreite des Dropdowns
bgrndr% = Roter-Hintergrundfarbwert
bgrndg% = Gruener-Hintergrundfarbwert
bgrndb% = Blauer-Hintergrundfarbwert
colorr% = Roter-Zeichenfarbwert
colorg% = Gruener-Zeichenfarbwert
colorb% = Blauer-Zeichenfarbwert
downcr% = Roter-MouseOverfarbwert
downcg% = Gruener-MouseOverfarbwert
downcb% = Blauer-MouseOverfarbwert[/code:1:a058f0d334]

[code:1:a058f0d334][b] load_dropdowns (id%,content$,an%)[/b]

Definition:
Laed einen String als Inhalt in eine Dropdownbox.
String ist im Format:
1.Auswahl+"#"+2.Auswahl+"#"+3.Auswahl+..............

Parameter Beschreibung:
id% = handle des Dropdowns
content$ = Inhalt des Dropdowns siehe Definiton
an% = Anzahl der Auswahlen (Ich weisz ich haette einen zaehler einbauen koenne, hatte aber bisher noch keinen bock drauf)[/code:1:a058f0d334]

Es muessen als variablen folgende geglobalt/gedimt werden:
[code:1:a058f0d334]Dim activedrop%(100),choosedrop%(100)
Dim dropcontents$(100,100),anz%(100)
Global mouse1%[/code:1:a058f0d334]

Und und jedes frame der hauptschleife sollte dieser Coder erscheinen:
[code:1:a058f0d334]mouse1=MouseHit(1)[/code:1:a058f0d334]

So, und jetzt der code:
[code:1:a058f0d334]Function load_dropdowns(id%,content$,an%)
choosedrop(id%)=1
anz%(id%)=an%
For i = 1 To an%
If Instr(content$,"#")
dropcontents$(id%,i)=Left(content$,Instr(content$,"#")-1)
content$ = Right(content$,Len(content$)-Instr(content$,"#")-1)
Else
dropcontents$(id%,i)=content$
End If
Next
End Function



Function dropdown(id%,x%=0,y%=0,width%=100,bgrndr%=60,bgrndg%=60,bgrndb%=60,colorr%=200,colorg%=200,colorb%=200,downcr%=0,downcg%=0,downcb%=0)
Color bgrndr%,bgrndg%,bgrndb%
Rect x%,y%,width%-FontHeight()-2,FontHeight()+2,1
Rect x%+width-FontHeight(),y%,FontHeight(),FontHeight()+2,1
Color colorr%,colorg%,colorb%
Rect x%,y%,width%-FontHeight()-2,FontHeight()+2,0
Rect x%+width%-FontHeight(),y%,FontHeight(),FontHeight()+2,0
Line x%+width%-FontHeight()/4*3,y%+FontHeight()/4+2,x%+width%-FontHeight()/2-1,y%+FontHeight()/4*3+1
Line x%+width%-FontHeight()/4-2,y%+FontHeight()/4+2,x%+width%-FontHeight()/2-1,y%+FontHeight()/4*3+1
Text x%+1,y%+1,dropcontents$(id%,choosedrop(id%))

If MouseX()<x%+width% And MouseX()>x%+width%-FontHeight() And MouseY()>y% And MouseY()<y%+FontHeight() And mouse1 Then activedrop%(id%)=1-activedrop%(id%)

If activedrop%(id%)
Color bgrndr%,bgrndg%,bgrndb%
Rect x%,y%+FontHeight()+4,width%-FontHeight()-2,anz(id%)*(FontHeight()+2),1
Color colorr%,colorg%,colorb%
Rect x%,y%+FontHeight()+4,width%-FontHeight()-2,anz(id%)*(FontHeight()+2),0

For i = 1 To anz(id%)
If MouseX()<x%+width%-FontHeight() And MouseX()>x% And MouseY()>y%+i*(FontHeight()+2)+2 And MouseY()<y%+i*(FontHeight()+2)+2+FontHeight()
Color downcr%,downcg%,downcb%
Rect x%+1,y%+i*(FontHeight()+2)+3,width%-FontHeight()-4,FontHeight()
If mouse1% Then choosedrop(id%) = i : activedrop(id%)=0
End If
Color colorr%,colorg%,colorb%
Text x%,y%+i*(FontHeight()+2)+2,dropcontents(id%,i)
Next
End If
End Function[/code:1:a058f0d334]

So und jetz ein beispiel:
[code:1:a058f0d334]Graphics 800,600,16,2
Dim activedrop%(100),choosedrop%(100)
Dim dropcontents$(100,100),anz%(100)
Global mouse1%

load_dropdowns(1,"sfkl#asdfjudzuj#sdtghgfhsh#dzujc",4)

While Not KeyHit(1)
mouse1=MouseHit(1)
dropdown(1,100,200,200,255,255,255,0,0,255,200,200,200)
Flip
Cls
Wend
End

Function load_dropdowns(id%,content$,an%)
choosedrop(id%)=1
anz%(id%)=an%
For i = 1 To an%
If Instr(content$,"#")
dropcontents$(id%,i)=Left(content$,Instr(content$,"#")-1)
content$ = Right(content$,Len(content$)-Instr(content$,"#")-1)
Else
dropcontents$(id%,i)=content$
End If
Next
End Function



Function dropdown(id%,x%=0,y%=0,width%=100,bgrndr%=60,bgrndg%=60,bgrndb%=60,colorr%=200,colorg%=200,colorb%=200,downcr%=0,downcg%=0,downcb%=0)
Color bgrndr%,bgrndg%,bgrndb%
Rect x%,y%,width%-FontHeight()-2,FontHeight()+2,1
Rect x%+width-FontHeight(),y%,FontHeight(),FontHeight()+2,1
Color colorr%,colorg%,colorb%
Rect x%,y%,width%-FontHeight()-2,FontHeight()+2,0
Rect x%+width%-FontHeight(),y%,FontHeight(),FontHeight()+2,0
Line x%+width%-FontHeight()/4*3,y%+FontHeight()/4+2,x%+width%-FontHeight()/2-1,y%+FontHeight()/4*3+1
Line x%+width%-FontHeight()/4-2,y%+FontHeight()/4+2,x%+width%-FontHeight()/2-1,y%+FontHeight()/4*3+1
Text x%+1,y%+1,dropcontents$(id%,choosedrop(id%))

If MouseX()<x%+width% And MouseX()>x%+width%-FontHeight() And MouseY()>y% And MouseY()<y%+FontHeight() And mouse1 Then activedrop%(id%)=1-activedrop%(id%)

If activedrop%(id%)
Color bgrndr%,bgrndg%,bgrndb%
Rect x%,y%+FontHeight()+4,width%-FontHeight()-2,anz(id%)*(FontHeight()+2),1
Color colorr%,colorg%,colorb%
Rect x%,y%+FontHeight()+4,width%-FontHeight()-2,anz(id%)*(FontHeight()+2),0

For i = 1 To anz(id%)
If MouseX()<x%+width%-FontHeight() And MouseX()>x% And MouseY()>y%+i*(FontHeight()+2)+2 And MouseY()<y%+i*(FontHeight()+2)+2+FontHeight()
Color downcr%,downcg%,downcb%
Rect x%+1,y%+i*(FontHeight()+2)+3,width%-FontHeight()-4,FontHeight()
If mouse1% Then choosedrop(id%) = i : activedrop(id%)=0
End If
Color colorr%,colorg%,colorb%
Text x%,y%+i*(FontHeight()+2)+2,dropcontents(id%,i)
Next
End If
End Function[/code:1:a058f0d334]

Ich weisz, das es komigerweisze als nicht exe, wenn man es ausprobiert, leiocht flakkert, aber als exe funzt bei mir alles wunderbar.

[EDIT]
Also ich hab da was wichtiges vergessen also so kann man die Auswahl einlesen:
choosedrop%(id%) ist die variable der auswahl und wenn man davon den inhalt haben will macht man das:
dropcontents$(id%,choosedrop%(id%))



Suche:
(unterstützt mySQL Wildcards ala %)
Titel:
Text:
Autor: