DialogDesigner2 — a tool to compose XML dialogs

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by ChrisR »

Thanks, I have now managed to add several Gadgets :)
I had initially tried with a ScrollArea Container, seems better with HBox, VBox, GridBox or MultiBox.
The Faq's on the 1st post should be usefull for newsbie like me.
User avatar
tj1010
Enthusiast
Enthusiast
Posts: 621
Joined: Mon Feb 25, 2013 5:51 pm
Location: US or Estonia
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by tj1010 »

This is something both SB and PB desperately needs. I'd even argue Dialog lib should replace the Window, Toolbar, Menu, and Gadget libraries completely since static geometry is pretty much obsolete in the field of UI/UX in 2017(since there is stuff with CGA all the way to 4K resolutions and different dynamic aspect ratios) and writing your own handlers even from templates is annoying.

Feature Requests from my brief testing:
  • Copy to Clipboard for both code and xml export
  • Some form of code stub to handle relative font sizing with native PB and SB font per platform. Basically LoadFont with a relative value for "Size" using window timer or thread state machine and sweep all text based gadgets using SetGadgetFont?
I made a pretty complex UI with it within 30 minutes of downloading it. My only complaints are with Dialog lib itself in how it has no way to control height expansion(no maxheight on anything but Window and SingleBox) and how it handles image cropping.

I think PB Dialog lib XML is identical to SB Dialog lib XML so your tool already works there too..
The truth hurts.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by Lunasole »

tj1010 wrote:This is something both SB and PB desperately needs. I'd even argue Dialog lib should replace the Window, Toolbar, Menu, and Gadget libraries completely since static geometry is pretty much obsolete in the field of UI/UX in 2017(since there is stuff with CGA all the way to 4K resolutions and different dynamic aspect ratios) and writing your own handlers even from templates is annoying.

...
I made a pretty complex UI with it within 30 minutes of downloading it. My only complaints are with Dialog lib itself in how it has no way to control height expansion(no maxheight on anything but Window and SingleBox) and how it handles image cropping.
Yes that library is really cool thing and decreases UI pain a lot, even though it is obliously not fully completed for now.

However it also has another problem -- those "runtime" procedures and dialogs xml itself are placed into binary as plain text, that of course allows easily to modify them and generally makes binary much more hackable. I was planning to add some obfuscation/encryption to fix this partially (and there are some other related ideas), but currently all remains as is.

I think PB Dialog lib XML is identical to SB Dialog lib XML so your tool already works there too..
Nice if so. Btw I wouldn't be surprised if it was created for SB originally ^_^ As it really follows a lot concepts from web / CSS.

Feature Requests from my brief testing:
  • Copy to Clipboard for both code and xml export
  • Some form of code stub to handle relative font sizing with native PB and SB font per platform. Basically LoadFont with a relative value for "Size" using window timer or thread state machine and sweep all text based gadgets using SetGadgetFont?
Nice 2 ideas, one which is first I'll probably add when program finally will get own options/config (thus it will be possible to switch export behavior between file and CB, to not bloat popup menu).

What about 2nd, I have idea of adding code like this (and related function to define font from designer):

Code: Select all

  Define x = LoadFont(#PB_Any, "Consolas", 25)
  SetGadgetFont(-1, FontID(x))
Executed before dialogs open, it will replace all dialog gadgets font with one loaded, then dialog library automatically resizes controls and windows to fit all text with that loaded font/size.

Just didn't get what you mean as relative font size value? DPI scale factor? (if yes, it's not needed, at least Windows scales fonts automatically)


// hell I'm writing too much text after overdosed coffee + got brain hyperactivity from weather which is finally nice & summer :mrgreen:
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
tj1010
Enthusiast
Enthusiast
Posts: 621
Joined: Mon Feb 25, 2013 5:51 pm
Location: US or Estonia
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by tj1010 »

Lunasole wrote: ...
Yes that library is really cool thing and decreases UI pain a lot, even though it is obliously not fully completed for now.

However it also has another problem -- those "runtime" procedures and dialogs xml itself are placed into binary as plain text, that of course allows easily to modify them and generally makes binary much more hackable. I was planning to add some obfuscation/encryption to fix this partially (and there are some other related ideas), but currently all remains as is.
...

What about 2nd, I have idea of adding code like this (and related function to define font from designer):

Code: Select all

  Define x = LoadFont(#PB_Any, "Consolas", 25)
  SetGadgetFont(-1, FontID(x))
Executed before dialogs open, it will replace all dialog gadgets font with one loaded, then dialog library automatically resizes controls and windows to fit all text with that loaded font/size.

Just didn't get what you mean as relative font size value? DPI scale factor? (if yes, it's not needed, at least Windows scales fonts automatically)
Proportionate to what it was in it's first state while maintaining aspect ratio. Like if a string field got taller and wider go as wide and tall as possible up to original proportion without breaking font aspect ratio. Basically keeping font same size relative to the gadget as it was originally.

I'm not even sure this is possible though without API stuff. You basically have to reload fonts and I seem to remember PB falls back to rounded font sizes or something.

A good test case would be a 800x600 dialog window maximized or dragged up to 4k.
Last edited by tj1010 on Wed May 17, 2017 6:12 pm, edited 1 time in total.
The truth hurts.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by Lunasole »

tj1010 wrote: Proportionate to what it was in it's first state while maintaining aspect ratio. Like if a string field got taller and wider go as wide and tall as possible up to original proportion without breaking font aspect ratio. Basically keeping font same size relative to the gadget as it was originally.

I'm not even sure this is possible though without API stuff. You basically have to reload fonts and I seem to remember PB falls back to rounded font sizes or something.
I think too this will need API. Also it looks too complicated/specific to add it to code generator.

But your idea give me other idea ^^ For example, it is not too hard to make some simplest "plugin" system for Designer, to allow anyone generate code as they want, using custom DLL coded in PB for that.

// but well, "on a second view" such idea also looks too big for such a small tool. I don't think that lot of ppl are or will be using DD2
Probably should better ask Fred for plugin support :D (hah, I already did it once, seems it's hard for 3 platforms simultaneously)

Anyway, thanks for reply
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
tj1010
Enthusiast
Enthusiast
Posts: 621
Joined: Mon Feb 25, 2013 5:51 pm
Location: US or Estonia
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by tj1010 »

I'll probably use it regularly to prototype and export XML. My big projects hide screens by hiding containers. The write&run process of UI design is exponentially longer and more expensive. I do the same thing on mobile.

EDIT: Regarding XML hacking: Base64 over AES encrypt or ROT13 or packed memory in resource section. Anyone who can beat that can patch a UI structure and handler anyway..
The truth hurts.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by Lunasole »

Spent some time for 1.0.0.5 :) See changes in that readme.
tj1010 wrote: EDIT: Regarding XML hacking: Base64 over AES encrypt or ROT13 or packed memory in resource section. Anyone who can beat that can patch a UI structure and handler anyway..
Btw adding handlers using BindEvent() for example (instead of XML) should make some difference also.
Anyway "just ideas", for now I didn't needed something with encrypted or obfuscated dialogs
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
tj1010
Enthusiast
Enthusiast
Posts: 621
Joined: Mon Feb 25, 2013 5:51 pm
Location: US or Estonia
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by tj1010 »

You have to restart to get the clipboard to work after clicking it. "Import XML" is a must for multi-sitting UI/UX projects; I can kind of see how to code this just crawling xml tree and mapping attributes using a stack technique and just fail gracefully on all parsing errors instead of trying to heuristically solve them..

Another design problem I find with Dialog lib in both SB and PB is you can't just swap containers in place with visible for easy app screens.. Your options are swapping windows or loading different dialogs. This is a problem because dialog-windows size to content and not desktop or desktop changes so you have to iterate over all windows and adjust window sizes relative to desktop or mobile screen new dimensions.. This means thread or timer or callback and custom aspect ratio calculating code.. You can only have one window for #PB_Window_Background in SB too so that shortcut is missed..
The truth hurts.
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by Kiffi »

@Lunasole: Is there any chance to compile a linux-version?

Thanks in advance & Greetings ... Peter
Hygge
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by Lunasole »

Kiffi wrote:@Lunasole: Is there any chance to compile a linux-version?
I like idea, but don't like linux a lot ^^ I like it's "ideology", but don't like what it became on practice. As for me modern linux is like USSR with it perverted socialism realization.

Well that was some useless "lyric" :mrgreen:
Some key parts of DD2 are made using WinAPI customizations and I'm pretty sure linux can't even provide comparable analogues for that, so generally it looks impossible to port it and I'd suggest only to use something like Wine on linux (hope it works fine and can help)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
tj1010
Enthusiast
Enthusiast
Posts: 621
Joined: Mon Feb 25, 2013 5:51 pm
Location: US or Estonia
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by tj1010 »

People can't even get static layouts to work typically under GTK3..
The truth hurts.
User avatar
Didelphodon
PureBasic Expert
PureBasic Expert
Posts: 448
Joined: Sat Dec 18, 2004 11:56 am
Location: Vienna - Austria
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by Didelphodon »

Thx for sharing, this is absolutely useful stuff!
Go, tell it on the mountains.
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by loulou2522 »

Is there some news about your wonderfull programm ?
Thanks
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by Lunasole »

loulou2522 wrote:Is there some news about your wonderfull programm ?
Well currently I don't have "big reasonable ideas" of new things ^^
Here is some update made recently:
1.0.0.6
- Output: greatly changed events handling code (now it used 'native' event binding, instead of xml-defined)
// surely that bloats resulting code, but also:
// - bypasses PB bugs with canvas/other controls
// - removes runtime procedures/library
// - generally is "more flexible" ^^
// no more OnEvent attribute in exported code XML, while special "dd2events" attribute used on raw XML export (ignored by dialogs library as invalid)
- Output: now every event handler has local variable "this"
- Output: fixed missing window declares in cases when no UI callbacks generated
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
vwidmer
Enthusiast
Enthusiast
Posts: 282
Joined: Mon Jan 20, 2014 6:32 pm

Re: DialogDesigner2 — a tool to compose XML dialogs

Post by vwidmer »

Can you please compile for linux?

Thanks
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
Post Reply