@Markus
Markus wrote: "Mobiius
you not wrote a better solution.
i used it there because i not want leave the task
config dialog, and because we not have windows
i clear current form, open a sub form, and after return then
i show up the dialog ui again.
"
How is this
3 lines commented out. (lines: 11, 258, 266)
2 lines added. (lines: 12, 268)
Not tested, but should work.
function ConfigDialog(btnMenu,sKlickKlack,imgFont)
local BackgroundMaterial as integer
BackgroundMaterial=Config.BackgroundMaterial
local x as integer
local y as integer
local ox as integer
//~ ConfigDialogBegin:
Repeat
x=1
y=1
ox=38
//--------------------------------------------- Background
local sprBack as integer
sprBack=loadsprite("spot256.png")
setspritesize(sprBack,100,100)
setspritecolor(sprBack,255,255,255,192)
setspritedepth(sprBack,2)
//---------------------------------------------
local iLabel1 as integer
iLabel1=createtext("Player Name:")
SetTextPosition( iLabel1, x, y )
settextdepth(iLabel1,0)
local iEdit1 as integer
iEdit1=CreateMyEditBox(x+ox,y,48,5,Config.PlayerName$,32,imgFont)
y=y+5+1
//---------------------------------------------
local iLabel2 as integer
iLabel2=createtext("Network Name:")
SetTextPosition( iLabel2, x, y )
settextdepth(iLabel2,0)
local iEdit2 as integer
iEdit2=CreateMyEditBox(x+ox,y,48,5,Config.NetworkName$,32,imgFont)
y=y+5+1
//---------------------------------------------
local iLabel3 as integer
iLabel3=createtext("Grid Snap 1 (On) 0 (Off):")
SetTextPosition( iLabel3, x, y )
settextdepth(iLabel3,0)
local iEdit3 as integer
iEdit3=CreateMyEditBox(x+ox,y,8,5,str(Config.GridSnap),1,imgFont)
y=y+5+1
//---------------------------------------------
local iLabel4 as integer
iLabel4=createtext("WWW Connect to IP:")
settextdepth(iLabel4,0)
SetTextPosition( iLabel4, x, y )
local iEdit4 as integer
iEdit4=CreateMyEditBox(x+ox,y,48,5,Config.ServerIP$,3+1+3+1+3+1+3,imgFont)
//iEdit4=CreateMyEditBox(x+ox,y,48,5,Config.ServerIP$,32,imgFont) // dyndns geht irgendwie nicht
y=y+5+1
//---------------------------------------------
local iLabel5 as integer
iLabel5=createtext("WWW Connect to Port:")
SetTextPosition( iLabel5, x, y )
settextdepth(iLabel5,0)
local iEdit5 as integer
iEdit5=CreateMyEditBox(x+ox,y,16,5,str(Config.ServerPort),5,imgFont)
y=y+5+1
//---------------------------------------------
local iLabel6 as integer
iLabel6=createtext("Background Color 0-19:")
SetTextPosition( iLabel6, x, y )
settextdepth(iLabel6,0)
local iEdit6 as integer
iEdit6=CreateMyEditBox(x+ox,y,8,5,str(Config.BackgroundColor),3,imgFont)
//Farbe anzeigen
local iSprite6 as integer
iSprite6=createsprite(0)
setspriteposition(iSprite6,x+ox+8+1,y)
setspritesize(iSprite6,5,5)
setspritedepth(iSprite6,0)
SpriteColorFromEditBox(iSprite6,iEdit6)
y=y+5+1
//---------------------------------------------
local iLabel7 as integer
iLabel7=createtext("Background Material 0-4:")
SetTextPosition( iLabel7, x, y )
settextdepth(iLabel7,0)
local iEdit7 as integer
iEdit7=CreateMyEditBox(x+ox,y,8,5,str(Config.BackgroundMaterial),3,imgFont)
//Muster anzeigen
local iSprite7 as integer
iSprite7=createsprite(0)
setspriteposition(iSprite7,x+ox+8+1,y)
setspritesize(iSprite7,32,-1)
setspritedepth(iSprite7,0)
iSprite7=SpriteBackgroundFromEditBox(iSprite7,iEdit7,iSprite6)
local iLabel9 as integer
iLabel9=createtext("< Push")
SetTextPosition( iLabel9, getspritex(iSprite7)+getspritewidth(iSprite7)+1 , y )
settextdepth(iLabel9,0)
y=y+5+1
//---------------------------------------------
local iLabel8 as integer
iLabel8=createtext("Notation 0 (Off) 1 (On):")
SetTextPosition( iLabel8, x, y )
settextdepth(iLabel8,0)
local iEdit8 as integer
iEdit8=CreateMyEditBox(x+ox,y,8,5,str(Config.Notation),1,imgFont)
y=y+5+1
//--------------------------------------------- Wait Ready
local subselect as integer
subselect=0
local mx# as float
local my# as float
do
mx#=getpointerx()
my#=getpointery()
if getpointerpressed()=1 and GetSpriteHitTest(iSprite6,mx#,my#)=1 //Farb Auswahl
//lieber hier raus,auswahl und wieder hier rein
subselect=2
endif
if getpointerpressed()=1 and GetSpriteHitTest(iSprite7,mx#,my#)=1 //Muster Auswahl
//lieber hier raus,auswahl und wieder hier rein
subselect=1
endif
if GetEditBoxChanged(iEdit6) =1 //Farbe
//print("Changed")
SpriteColorFromEditBox(iSprite6,iEdit6)
iSprite7=SpriteBackgroundFromEditBox(iSprite7,iEdit7,iSprite6)
endif
if GetEditBoxChanged(iEdit7) =1 //Muster
//print("Changed")
iSprite7=SpriteBackgroundFromEditBox(iSprite7,iEdit7,iSprite6)
endif
if GetVirtualButtonPressed(btnMenu)=1 //Menu
playsound(sKlickKlack)
exit
endif
sync()
if subselect>0
exit
endif
loop
//--------------------------------------------- Get
Config.PlayerName$=GetEditBoxText(iEdit1)
Config.NetworkName$=GetEditBoxText(iEdit2)
local V as integer
V=val(GetEditBoxText(iEdit3))
if V<0 then V=0
if V>1 then V=1
Config.GridSnap=V
Config.ServerIP$=GetEditBoxText(iEdit4)
local P as integer
P=val(GetEditBoxText(iEdit5))
if P<1025 then P=1025
if P>65535 then P=65535
Config.ServerPort=P
local C as integer
C=val(GetEditBoxText(iEdit6))
if C<0 then C=0
if C>19 then C=19
Config.BackgroundColor=C
V=val(GetEditBoxText(iEdit7))
if V<0 then V=0
if V>4 then V=4
Config.BackgroundMaterial=V
V=val(GetEditBoxText(iEdit8))
if V<0 then V=0
if V>1 then V=1
Config.Notation=V
ConfigSave()
//--------------------------------------------- Free
deletetext(iLabel1)
deletetext(iLabel2)
deletetext(iLabel3)
deletetext(iLabel4)
deletetext(iLabel5)
deletetext(iLabel6)
deletetext(iLabel7)
deletetext(iLabel8)
deletetext(iLabel9) //click
sync()
deleteeditbox(iEdit1)
deleteeditbox(iEdit2)
deleteeditbox(iEdit3)
deleteeditbox(iEdit4)
deleteeditbox(iEdit5)
deleteeditbox(iEdit6)
deleteeditbox(iEdit7)
deleteeditbox(iEdit8)
sync()
deletesprite(iSprite6)
deletesprite(iSprite7)
sync()
deletesprite(sprBack)
ret as integer
ret=0
if BackgroundMaterial<>Config.BackgroundMaterial then ret=1
//Texture
if subselect=1
setvirtualbuttonvisible(btnMenu,0)
ConfigChoosePattern()
setvirtualbuttonvisible(btnMenu,1)
//~ goto ConfigDialogBegin
endif
//Farbe
if subselect=2
setvirtualbuttonvisible(btnMenu,0)
ConfigChooseColor()
setvirtualbuttonvisible(btnMenu,1)
//~ goto ConfigDialogBegin
endif
Until subselect > 0
endfunction ret