I have:
txtplgCoolBOX = TextGadget(#PB_Any, 0, 10, 100, 25, "plgCoolBOX", #PB_Text_Center)
I would like to do something like
SetGadgetText(Val("txt"+deviceName$),"CoolerBox")
this does not work..
how can I do something like this?
Thanks
Call gadget with variable?
Call gadget with variable?
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA
- NicTheQuick
- Addict
- Posts: 1227
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Call gadget with variable?
This only works with Maps:
But why do you want this? Seems a bit odd to me.
Code: Select all
NewMap gadgets.i()
gadgets("txtplgCoolBOX") = TextGadget(#PB_Any, 0, 10, 100, 25, "plgCoolBOX", #PB_Text_Center)
SetGadgetText(gadgets("txt" + deviceName$), "CoolerBox")
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: Call gadget with variable?
Thanks I will try.
I have a few containers that have text, button
I have a function that's pulling info from multiple urls and then need to populate the info above.
So I would like to just have a loop to do that without having to call each gadget.
Maybe there is a better way to do that?
I have a few containers that have text, button
I have a function that's pulling info from multiple urls and then need to populate the info above.
So I would like to just have a loop to do that without having to call each gadget.
Maybe there is a better way to do that?
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA
Re: Call gadget with variable?
I still have no idea what you are going to do, but my proposal would be:
use Dialogs
use Dialogs
Code: Select all
Procedure.s GetXMLString()
Protected XML$
XML$ + "<?xml version='1.0' encoding='UTF-16'?>"
XML$ + ""
XML$ + "<dialogs>"
XML$ + " <window name='win_main' flags='#PB_Window_SystemMenu' minwidth='200' xpos='407' ypos='541'>"
XML$ + " <vbox>"
XML$ + " <text name='txtplgCoolBOX' text='plgCoolBOX' flags='#PB_Text_Center'/>"
XML$ + " </vbox>"
XML$ + " </window>"
XML$ + "</dialogs><!--DDesign0R Definition: PureBasic|1|1|0||-|0-->"
ProcedureReturn XML$
EndProcedure
a$ = GetXMLString()
If ParseXML(0, a$) And XMLStatus(0) = #PB_XML_Success
CreateDialog(0)
OpenXMLDialog(0, 0, "win_main")
deviceName$ = "plgCoolBOX"
SetGadgetText(DialogGadget(0, "txt" + deviceName$), "CoolerBox")
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{Downloads}.:|:.{History Viewer Online}
Re: Call gadget with variable?
You can also use the Runtime operator for this:
Code: Select all
Define txtplgCoolBOX
Runtime txtplgCoolBOX
OpenWindow(0, 100, 100, 600, 400, "Test")
txtplgCoolBOX = TextGadget(#PB_Any, 0, 10, 100, 25, "plgCoolBOX", #PB_Text_Center)
SetGadgetText(GetRuntimeInteger("txtplgCoolBOX"), "CoolerBox")
Repeat
event = WaitWindowEvent()
Until Event= #PB_Event_CloseWindow
- NicTheQuick
- Addict
- Posts: 1227
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Call gadget with variable?
Oh, right. I totally forget about the Runtime things.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.