field not updating

BlitzMax Forums/MaxGUI Module/field not updating

D4NM4N(Posted 2006) [#1]
how can i force a field to display something.
Im using a file requester to get a filename, but its not being put in the textfield. However, if i click in the field it suddenly appears!!??


tonyg(Posted 2006) [#2]
Any code?
SetGadgetText?


D4NM4N(Posted 2006) [#3]
setgadgettext is being used but wont actually display the contents visually til i click on the field, or change the tab its on and then back again.

		Case btn_browsetex[item]	' user pressed button
			Local filter$="Texture Files(png,bmp,jpg,tga,dds):png,bmp,jpg,tga,dds;"
			Local filename$=RequestFile( "Select mesh file to open",filter$ )
			SetGadgetText fld_tex[item],filename$ 				




tonyg(Posted 2006) [#4]
activategadget?
SuperStrict

Local MyWindow:TGadget=CreateWindow("TextField Example", 200,200,320,240)
Local Label0:TGadget=CreateLabel("filename:",10,10,100,20,MyWindow)
Local MyInput:TGadget=CreateTextField(110,10,180,20,MyWindow)
Local filter$="Texture Files(png,bmp,jpg,tga,dds):png,bmp,jpg,tga,dds;"
Local filename$=RequestFile( "Select mesh file to open",filter$ )
ActivateGadget(myinput)
SetGadgetText(myinput,filename)
Repeat
Forever



D4NM4N(Posted 2006) [#5]
ill try that i tried activate gadget, but after id set the text

#edit
tried it but its almost as if the text is in white!? When i use drag select i can read it but it doesnt turn black until i perform another gadget action


tonyg(Posted 2006) [#6]
Both should work.
One will activate the textfield then put the text in.
The other puts in the text, activates the textfield and selects the text.
If the simple example works then it's probably a code problem where you'd need to post a small example.

<edit> Saw your update. Does the same thing happen with the example I posted?


D4NM4N(Posted 2006) [#7]
I now know why its happening, its because the file requester is over the fields. If i move the calling app over a bit and do it again, the text is only missing where the requester was.

Still no solution though, i need a

ForceRedrawAllGadgetsRightNowThisInstant() function :)


Dreamora(Posted 2006) [#8]
What does "item" actually refer to? Do you select case for all buttons in a loop or something similar?

On the above example: don't see why activate should be needed. Main reason the above does not work is because the event is never processed:
SuperStrict

Global MyWindow:TGadget=CreateWindow("TextField Example", 200,200,320,240)
Global Label0:TGadget=CreateLabel("filename:",10,10,100,20,MyWindow)
Global MyInput:TGadget=CreateTextField(110,10,180,20,MyWindow)
Global filter$="Texture Files(png,bmp,jpg,tga,dds):png,bmp,jpg,tga,dds;"
Global filename$=RequestFile( "Select mesh file to open",filter$ )
SetGadgetText(myinput,filename)
Repeat
	WaitEvent() 
Forever



D4NM4N(Posted 2006) [#9]
item is just a quick way of adding several gadgets to a tabber which has the same items on each page. (for next 0-9)


D4NM4N(Posted 2006) [#10]
Heh sorted it, it seemed to be a problem with the tabber.
if i call this after setting the text all is good.
Function showtab(currenttab)
  For Local item=0 to 9 
    HideGadget grp_mesh[item]
    if item=currenttab ShowGadget grp_mesh[item]
  Next			
End Function


Even though the gadgets are hidden, something about the file requester being on top of them made them (well, their fields anyway) visible again.

thanks for your help