Is there a way to get the XML Node Pointer from the Gadget/Window?
Something like GetDialogGadgetXMLNode(#Dialog,Gadget$)
So you could add custom attributes to the Gadget that can, for example, be processed in the eventprocedure. Also you could change the color or the appearance in a custom way and anybody could write his own advance dialogfeatures.
Dialog - Get Gadget/Window XML Node
-
- New User
- Posts: 4
- Joined: Sat Aug 10, 2013 8:11 am
Re: Dialog - Get Gadget/Window XML Node
You can use the XML library command before creating the dialog to do that.
-
- New User
- Posts: 4
- Joined: Sat Aug 10, 2013 8:11 am
Re: Dialog - Get Gadget/Window XML Node
Hmm, I don't know if you understood my request or if i just did not understand your advice.
Example XML ( look at Button1 - attribute: customtext - as example)
Example PB in my mind (look at the "fantasy" Runtime Procedure where I try to receive the content of the gadgets "customtext"-Attribute )
Example XML ( look at Button1 - attribute: customtext - as example)
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<window name="win_main" width="600" height="400" text="Main Window">
<gridbox columns="2">
<button name="Button1" text="Test 1" onevent="Button1Event()" customtext="The Custom Text" />
<button name="Button2" text="Test 2" />
</gridbox>
</window>
Code: Select all
#XML = 0
#Dialog = 0
Runtime Procedure Button1Event()
*GadgetNode = GetDialogGadgetXMLNode(#Dialog,"button1") ; The XMLNode of the Gadget "button1", how can I get it?
Debug GetXMLAttribute(*GadgetNode,"customtext") ; Would show me the string "The Custom Text" of the attribute "customtext"
EndProcedure
If LoadXML(#XML, "dialog.xml")
If XMLStatus(#XML) = #PB_XML_Success
CreateDialog(#Dialog)
If OpenXMLDialog(#Dialog, #XML, "")
HideWindow(DialogWindow(#Dialog), #False)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
EndIf
EndIf
Re: Dialog - Get Gadget/Window XML Node
Hello,
Modifying the XML sort of defeats the purpose of dialog templates. If you'd like to customize controls at runtime, see dialogGadget. After you got the gadget ID, you can use SetGadgetAttribute, etc, as usual.
Erion
Modifying the XML sort of defeats the purpose of dialog templates. If you'd like to customize controls at runtime, see dialogGadget. After you got the gadget ID, you can use SetGadgetAttribute, etc, as usual.
Erion
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.
- W. B.
Visit my site, also for PureBasic goodies http://erion.tdrealms.com
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.
- W. B.
Visit my site, also for PureBasic goodies http://erion.tdrealms.com
-
- New User
- Posts: 4
- Joined: Sat Aug 10, 2013 8:11 am
Re: Dialog - Get Gadget/Window XML Node
It's not that I want to modify the Gadget.... it's about for example storing additional data to the gadget. Unknown xml Attributes seem to be ignored.. so i don't see any problem in adding additional attributes to the node. Therefore I only want to know the XML-NODE Address in order to read out the attributes.
Re: Dialog - Get Gadget/Window XML Node
Then you can use the XML library commands to locate the node of a given gadget, it should work.
-
- New User
- Posts: 4
- Joined: Sat Aug 10, 2013 8:11 am
Re: Dialog - Get Gadget/Window XML Node
I think now I got you... you mean for example by iterating recursively through the tree and storing the elements addresses that have a "name" attributes to a map. Ok, I just thought there would be another way. Not that it would be a problem, i was just playing around and thinking about the new feature. The Dialog functions will make many things easier....thanks for that.