Page 1 of 1

Tutorial for using XML Dialog?

Posted: Thu Jan 14, 2016 12:46 pm
by thinkitsimple
Hi,

i love the idea of separating code and UI using the XML based Dialog library.

The PureBasic help explains the commands, but is there a tutorial for people like me who are used to code the UI in PureBasic directly?

I would be nice, if someone who has already earned some experience in using the Dialog library in a complete app could give some introduction in this.

Thanks.

Re: Tutorial for using XML Dialog?

Posted: Sat Jan 16, 2016 4:26 pm
by Hadrianus
I was thinking the same thing a long time ago. I do not understand XML and Dialog library. I understand that XML has been invented to make things easier in computerworld, but in my opinion it's not.

Re: Tutorial for using XML Dialog?

Posted: Thu Mar 02, 2017 7:58 pm
by loulou2522
Hi all,
If someone has a tuto about dialogs he will be welcome
Thanks in advance

Re: Tutorial for using XML Dialog?

Posted: Fri Mar 03, 2017 12:24 am
by Andre
Not really a tutorial, but a powerful framework to ease the creating of dialogs (pure XML code is generated by the framework) and several GUI/Dialog example codes:
DynamicDialogs - creating dynamic Dialogs the easy way ...

Re: Tutorial for using XML Dialog?

Posted: Fri Mar 03, 2017 11:49 am
by loulou2522
Thanks Andre,
I try this example , but i have some trouble to understand what is a vbox, an hbox a gridbox, singlebox and multiplebox and what case in using it ?
Is there a program like pureform which allow to create windows visually ?
Thanks

Re: Tutorial for using XML Dialog?

Posted: Fri Mar 03, 2017 10:43 pm
by Andre
loulou2522 wrote:Thanks Andre,
I try this example , but i have some trouble to understand what is a vbox, an hbox a gridbox, singlebox and multiplebox and what case in using it ?
Is there a program like pureform which allow to create windows visually ?
If you mean for creating resizable dialogs (which use the functions/specifications of the Dialog library) I think not.

GUI designers for creating dialogs with the "standard" Gadget functions (of the Gadget library) are available in several forms, e.g. the mentioned PureForm. But most of them are not aware of different font sizes, resizing possibilities, etc. (except the PureVisionXP package I think).

With the mentioned 'DynamicDialogs' package and the included examples you should be able to find out the correct use, including the vbox (for arranging gadgets or further gadget groups vertically), the hbox (the same horizontally) or in a gridbox (table style).

Re: Tutorial for using XML Dialog?

Posted: Mon Mar 06, 2017 5:11 am
by Blue
My question is directed @Andre who seems to have experience using XML-based dialogs.

What advantage is there in using XML to create dialogs ?

I have no trouble reading and following standard PB code to create a window and populate it with gadgets that serve the application's goal.
But I'm completely befuddled when I look at XML code... :shock:

One thing i haven't done yet, however, is to follow Andre's suggestion to look at the Dynamic Dialog demos.
So I'm heading there right away.
But my question remains.

Re: Tutorial for using XML Dialog?

Posted: Mon Mar 06, 2017 9:36 am
by srod
Allows you to, some extent, separate GUI layout from program logic and, once you get used to it, makes knocking up even a quite complex dialog a breeze. I find it much easier to read the XML representation of a dialog than a bunch of PB commands in the IDE (though maybe that's just my particular coding style! :) )

There is also the fact that all layout/resizing and device independence logic is automatically handled for us which saves on a whole bunch of code, though of course that's really getting away from the 'why XML?' question.

Honestly, I am knocking out dialogs at a far more productive rate than I used to. Still use good old PB Window/Gadget functions mind for the main GUIs.

Probably not for everyone though, but I like being able to separate the dialog layout from the program logic. It's like the old form-designer/hand-coded GUI argument. I much prefer hand coding, but that's just me.

Re: Tutorial for using XML Dialog?

Posted: Mon Mar 06, 2017 10:32 am
by pwd
srod wrote:that's really getting away from the 'why XML?' question
I believe XML was chosen since it's already used in XUI (XML UI)

Re: Tutorial for using XML Dialog?

Posted: Mon Mar 06, 2017 3:57 pm
by Blue
@srod: thank you for taking the time.

I appreciate even more the advantages you point out, now that I've experienced them first-hand after spending quite a few hours and effort to familiarize myself with XML-based dialog building. Indeed, i do see how much faster and simpler coding becomes with the XML approach.
It's been an interesting, albeit belated, discovery. 8)
However, I still feel intimidated by all the XML 'wordiness'. :?

But that, I expect, will evaporate once I really start crafting my own, rather than simply reading and modifying other people's code.

Re: Tutorial for using XML Dialog?

Posted: Mon Mar 06, 2017 11:17 pm
by Andre
Hi blue,

while srod has already written about the general advantages of dialogs (for me this are automatically detecting/supporting different fonts, resizeable dialog windows+gadgets, manually calculation/coding of fixed gadget locations isn't needed) I initially had my problems with coding error-free XML dialog definitions. You can easily make simple errors (one char forgotten etc.), which you don't see before compiling and so executing the OpenXMLDialog() command with given XML dialog descriptions. So I needed a lot trial & error, before a dialog finally worked as expected...

That's why I tried and fully switched to the powerful DynamicDialogs framework, which not only makes the creation of Dialogs a lot more simpler, but also extend the regular functionality e.g. with easy support of different fonts in the same dialog, etc.

All in all I'm a lot more productive with DynamicDialogs, which also comes with several Dialog GUI examples (a very complex one also contributed by me). :D

Re: Tutorial for using XML Dialog?

Posted: Wed Mar 08, 2017 1:21 pm
by Blue
Hello Andre.
Andre wrote:You can easily make simple errors (one char forgotten etc.)... So I needed a lot trial & error, before a dialog finally worked as expected...
Same, same here. You're quite right.

Thank you your input and for pointing out the existence of DynamicDialogs. Indeed, as you say, it makes life as a coder much simpler. Curious as I am, I went looking into the include file... and I started having fainting spells. :oops:
Incredibly complex stuff :shock: ... to my feeble mind anyway!
So, for the time being, I'll stick to using it as a black box. 8)
Understanding will eventually come to me, along with wisdom and other goodies of old age !