Tutorial for using XML Dialog?

Just starting out? Need help? Post your questions and find answers here.
User avatar
thinkitsimple
User
User
Posts: 89
Joined: Mon Aug 13, 2012 6:12 pm
Location: Berlin, Germany
Contact:

Tutorial for using XML Dialog?

Post 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.
Michael

PureBasic 5.51, macOS 10.12.2 Sierra
Hadrianus
User
User
Posts: 34
Joined: Wed Mar 27, 2013 11:31 pm

Re: Tutorial for using XML Dialog?

Post 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.
loulou2522
Enthusiast
Enthusiast
Posts: 551
Joined: Tue Oct 14, 2014 12:09 pm

Re: Tutorial for using XML Dialog?

Post by loulou2522 »

Hi all,
If someone has a tuto about dialogs he will be welcome
Thanks in advance
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2139
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Tutorial for using XML Dialog?

Post 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 ...
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
loulou2522
Enthusiast
Enthusiast
Posts: 551
Joined: Tue Oct 14, 2014 12:09 pm

Re: Tutorial for using XML Dialog?

Post 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
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2139
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Tutorial for using XML Dialog?

Post 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).
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
Blue
Addict
Addict
Posts: 967
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Tutorial for using XML Dialog?

Post 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.
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Tutorial for using XML Dialog?

Post 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.
I may look like a mule, but I'm not a complete ass.
pwd
User
User
Posts: 60
Joined: Thu Sep 06, 2012 9:39 am

Re: Tutorial for using XML Dialog?

Post 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)
User avatar
Blue
Addict
Addict
Posts: 967
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Tutorial for using XML Dialog?

Post 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.
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2139
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Tutorial for using XML Dialog?

Post 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
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
Blue
Addict
Addict
Posts: 967
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Tutorial for using XML Dialog?

Post 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 !
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
Post Reply