Page 1 of 3

Questions about the new XmlDialog

Posted: Fri Jun 28, 2013 7:57 pm
by Kiffi

Code: Select all

<window id="0" name="hello" text="Window" label="TestDialog" width="640" height="480" flags="#PB_Window_SizeGadget">
  • What's the difference between id and name?
  • What is label for?
  • How to position a dialog? Neither y/x nor top/left work for me
Thanks in advance and greetings ... Kiffi

Re: Questions about the new XmlDialog

Posted: Fri Jun 28, 2013 8:07 pm
by Fred
- "id" is the purebasic #Window id of the created dialog (if missing, it will be #PB_Any). "name" is the name you need to put in OpenXMLDialog().
- "label" is an error, it's not supported and does nothing.
- about x,y: true, it should be added to OpenXMLDialog().

You can use ResizeWindow() for now if you need it.

Re: Questions about the new XmlDialog

Posted: Fri Jun 28, 2013 8:14 pm
by Kiffi
Thanks for your fast reply!

Greetings ... Kiffi

Re: Questions about the new XmlDialog

Posted: Sat Jun 29, 2013 2:54 pm
by BorisTheOld
@Fred

If I create an XML gui file using Glade, will PB be able to understand it?

Thanks

Re: Questions about the new XmlDialog

Posted: Sat Jun 29, 2013 3:12 pm
by Fred
No, it's custom PB XML.

Re: Questions about the new XmlDialog

Posted: Sat Jun 29, 2013 3:15 pm
by BorisTheOld
Thanks

Re: Questions about the new XmlDialog

Posted: Sun Aug 18, 2013 7:30 pm
by Little John
Fred wrote:- "label" is an error, it's not supported and does nothing.
In the current version 5.20 beta 11, the example file "ui.xml" still contains the text
label="TestDialog"
This is confusing, please remove the text.
Fred wrote:- about x,y: true, it should be added to OpenXMLDialog().
Documemtation of PB 5.20 beta 11 wrote:Result = OpenXMLDialog(#Dialog, #XML, Name$)
Did you make a different decision in the meantime, or does OpenXMLDialog() now haven x and y parameters, and this is just not documented?

Re: Questions about the new XmlDialog

Posted: Tue Aug 20, 2013 2:53 pm
by Kiffi
Little John wrote:does OpenXMLDialog() now haven x and y parameters
since 5.20 B12 it works. Thanks!
Result = OpenXMLDialog(#Dialog, #XML, Name$ [, x, y [, Width, Height [, ParentID]]])
Also #PB_Window_ScreenCentered is now supported. :D But unfortunately
the top / left position of the window is now centered. Not the window itself. ;-)

Code: Select all

#Dialog = 0
#Xml = 0

Define XML.s

XML = "<window id=''#PB_Any'' width=''500'' height=''500'' name=''test'' text=''test'' flags=''#PB_Window_ScreenCentered | #PB_Window_SystemMenu''>"
XML + "</window>"

XML = ReplaceString(XML, "''", Chr(34))
CatchXML(#Xml, @XML, Len(XML))
Result = CreateDialog(#Dialog)
Result = OpenXMLDialog(#Dialog, #Xml, "test")
HideWindow(DialogWindow(#Dialog), #False)

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Greetings ... Kiffi

Re: Questions about the new XmlDialog

Posted: Tue Aug 20, 2013 3:24 pm
by Fred
You also don't need to use HideWindow() anymore (unless #PB_Window_Invisible is set, indeed).

Re: Questions about the new XmlDialog

Posted: Tue Aug 20, 2013 4:52 pm
by Little John
Thanks.

Re: Questions about the new XmlDialog

Posted: Tue Aug 20, 2013 7:24 pm
by IdeasVacuum
Kiffi's code will not compile on WinXP x86 PB5.20 Beta12:

Code: Select all

#Dialog = 0
#Xml = 0

Define XML.s

XML = "<window id=''#PB_Any'' width=''500'' height=''500'' name=''test'' text=''test'' flags=''#PB_Window_ScreenCentered | #PB_Window_SystemMenu''>"
XML + "</window>"

XML = ReplaceString(XML, "''", Chr(34))
CatchXML(#Xml, @XML, Len(XML))
Result = CreateDialog(#Dialog)
Result = OpenXMLDialog(#Dialog, #Xml, "test")
HideWindow(DialogWindow(#Dialog), #False)

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Takes a month of Sundays, then fails: (1) HideWindow(); (2) WaitWindowEvent().

Re: Questions about the new XmlDialog

Posted: Tue Aug 20, 2013 7:32 pm
by ts-soft
@IdeasVacuum
Use ASCII-Compilermode.

Re: Questions about the new XmlDialog

Posted: Tue Aug 20, 2013 7:44 pm
by Little John
ts-soft wrote:@IdeasVacuum
Use ASCII-Compilermode.
... or replace

Code: Select all

CatchXML(#Xml, @XML, Len(XML))
with

Code: Select all

CatchXML(#Xml, @XML, StringByteLength(XML))
:)

Re: Questions about the new XmlDialog

Posted: Tue Aug 20, 2013 7:58 pm
by akj
Why does this slight variation of Kiffi's code generate a date gadget of enormous size? How do I specify a size of 200 x 50 pixels?

Code: Select all

#Dialog = 0
#Xml = 0

Define XML.s
XML = "<window id=''#PB_Any'' width=''500'' height=''500'' name=''test'' text=''test'' flags=''#PB_Window_ScreenCentered | #PB_Window_SystemMenu''>"
XML + "<date name=''datenow'' width=''200'' height=''50'' />" ; Extra code
XML + "</window>"

XML = ReplaceString(XML, "''", Chr(34))
CatchXML(#Xml, @XML, Len(XML))
Result = CreateDialog(#Dialog)
Result = OpenXMLDialog(#Dialog, #Xml, "test")
;!!! HideWindow(DialogWindow(#Dialog), #False)

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow

Re: Questions about the new XmlDialog

Posted: Tue Aug 20, 2013 8:43 pm
by Kiffi
akj wrote:How do I specify a size of 200 x 50 pixels?
you must use hbox and vbox:

Code: Select all

XML + "<vbox expand=''no''>" ; Extra code
XML + " <hbox expand=''no''>" ; Extra code
XML + "  <date name=''datenow'' width=''200'' height=''50'' />" ; Extra code
XML + " </hbox>" ; Extra code
XML + "</vbox>" ; Extra code
Greetings ... Kiffi