Questions about the new XmlDialog
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Questions about the new XmlDialog
Good tip Little John, thanks.
Why does it take so long to compile 12 lines of code though?
Why does it take so long to compile 12 lines of code though?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Questions about the new XmlDialog
Compiling that code takes, say, half a second here on my old PC.
Very probably it is a special problem on your system. My first guess is your anti-virus program running in the background.
Very probably it is a special problem on your system. My first guess is your anti-virus program running in the background.
Re: Questions about the new XmlDialog
@Kiffi:
Many thanks for your reply. I did exactly as you suggested, replacing my extra code by yours, but there is still a major problem.
The widths specified are honoured, but not the heights.
According to the incredibly useful WinDowse program (http://www.greatis.com/delphicb/windowse) the size of my displayed objects are:
Main window
--- Window W = 506 Window H = 1092
--- Client W = 500 Client H = 1061
Date gadget
--- Window W = 200 Window H = 32767
--- Client W =196 Client H = 32763
Why on earth does the date gadget have a height of 32767??
In case it is relevant I have dual monitors of size 1920x1080 and 1440x900 and am using PB 5.20 beta 12 under Windows 7 Ultimate service pack 1
Postscript:
If I use <singlebox> rather than <vbox> and <hbox> then the heights are honoured, but not the widths (the reverse of above). How strange.
Many thanks for your reply. I did exactly as you suggested, replacing my extra code by yours, but there is still a major problem.
The widths specified are honoured, but not the heights.
According to the incredibly useful WinDowse program (http://www.greatis.com/delphicb/windowse) the size of my displayed objects are:
Main window
--- Window W = 506 Window H = 1092
--- Client W = 500 Client H = 1061
Date gadget
--- Window W = 200 Window H = 32767
--- Client W =196 Client H = 32763
Why on earth does the date gadget have a height of 32767??
In case it is relevant I have dual monitors of size 1920x1080 and 1440x900 and am using PB 5.20 beta 12 under Windows 7 Ultimate service pack 1
Postscript:
If I use <singlebox> rather than <vbox> and <hbox> then the heights are honoured, but not the widths (the reverse of above). How strange.
Anthony Jordan
Re: Questions about the new XmlDialog
@Fred (or @All): do you have an example to show how to use <panel>?
... shows a PanelGadget but without a Tab. I have tried several attributes (name, label, id, text) but with no effect.
Thanks in advance & Greetings ... Kiffi
P.S.: Same with listicon & column.
Code: Select all
<panel>
<tab />
</panel>
Thanks in advance & Greetings ... Kiffi
P.S.: Same with listicon & column.
Hygge
Re: Questions about the new XmlDialog
@ kiffi
Have you had success with the panels?
Have you had success with the panels?
Re: Questions about the new XmlDialog
unfortunately not.hallodri wrote:@ kiffi
Have you had success with the panels?
Code: Select all
#Dialog = 0
#Xml = 0
Define XML.s
XML = "<window id='#PB_Any' width='300' height='300' name='test' text='test' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu'>"
XML + " <panel>"
XML + " <tab>123</tab>"
XML + " <tab text='123'></tab>"
XML + " <tab id='123'></tab>"
XML + " </panel>"
XML + "</window>"
CatchXML(#Xml, @XML, StringByteLength(XML))
CreateDialog(#Dialog)
OpenXMLDialog(#Dialog, #Xml, "test")
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Greetings ... Kiffi
Hygge
Re: Questions about the new XmlDialog
Looks like a bug, i'm on it.
edit: fixed for next beta.
edit: fixed for next beta.
Re: Questions about the new XmlDialog
Thanks! tabs inside of a panel are working now (since B13).Fred wrote:edit: fixed for next beta.

But columns inside a listicon are not displayed:
Code: Select all
#Dialog = 0
#Xml = 0
Define XML.s
XML = "<window id='#PB_Any' width='300' height='300' name='test' text='test' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu'>"
XML + " <panel>"
XML + " <tab text='Tab 1 (Panel)' expand='yes'>"
XML + " <panel>"
XML + " <tab text='Tab 1'></tab>"
XML + " <tab text='Tab 2'></tab>"
XML + " <tab text='Tab 3'></tab>"
XML + " </panel>"
XML + " </tab>"
XML + " <tab text='Tab 2 (Listicon)' expand='yes'>"
XML + " <listicon>"
XML + " <column text='Col 1' width='100'></column>"
XML + " <column text='Col 2' width='100'></column>"
XML + " <column text='Col 3' width='100'></column>"
XML + " </listicon>"
XML + " </tab>"
XML + " <tab text='Tab 3'></tab>"
XML + " </panel>"
XML + "</window>"
CatchXML(#Xml, @XML, StringByteLength(XML))
CreateDialog(#Dialog)
OpenXMLDialog(#Dialog, #Xml, "test")
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Another question: in the documentation i read that the attribute expand="yes" is default. Currently is it not default (try to remove the attribute in my sample above).
Thanks in advance & Greetings ... Kiffi
Hygge
Re: Questions about the new XmlDialog
'columns' and 'items' are not supported for this version. Fixed the 'expand' issue.
- Andre
- PureBasic Team
- Posts: 2137
- Joined: Fri Apr 25, 2003 6:14 pm
- Location: Germany (Saxony, Deutscheinsiedel)
- Contact:
Re: Questions about the new XmlDialog
Fred, please add this functionality before releasing the final.Fred wrote:'columns' and 'items' are not supported for this version. Fixed the 'expand' issue.
I often use the ListIconGadget for displaying structured information tables. Without the column support I can't use the new Dialog library...

Or is there any workaround in the meantime?
Thanks a lot!

Re: Questions about the new XmlDialog
What about ButtonImageGadget and ImageGadget?
How to add images using files or integrated in exe?
thanks
How to add images using files or integrated in exe?
thanks
Re: Questions about the new XmlDialog
Sure you can add the columns and the items after the dialog creation, it's not a problem (before your show it).Andre wrote:Fred, please add this functionality before releasing the final.Fred wrote:'columns' and 'items' are not supported for this version. Fixed the 'expand' issue.
I often use the ListIconGadget for displaying structured information tables. Without the column support I can't use the new Dialog library...![]()
Or is there any workaround in the meantime?
Thanks a lot!
Re: Questions about the new XmlDialog
The same way you would do with creating the window with regular PB command. Just use DialogGadget() to get the gadget number and you're done.cptdark wrote:What about ButtonImageGadget and ImageGadget?
How to add images using files or integrated in exe?
thanks
Re: Questions about the new XmlDialog
Andre wrote:Fred, please add this functionality before releasing the final.Fred wrote:'columns' and 'items' are not supported for this version. Fixed the 'expand' issue.
I often use the ListIconGadget for displaying structured information tables. Without the column support I can't use the new Dialog library...![]()
Or is there any workaround in the meantime?
Thanks a lot!
a small workaround
Code: Select all
;######################################################################
Procedure SearchListIcon(node, id=-1)
Protected index.i
Protected item.s
While node And id = -1
If LCase(GetXMLNodeName(node)) = "listicon"
SearchListIcon(ChildXMLNode(node), Val(GetXMLAttribute(node, "id")))
EndIf
If ChildXMLNode(node)
SearchListIcon(ChildXMLNode(node))
EndIf
node = NextXMLNode(node)
Wend
index = 0
While node And id > -1
If index = 0
RemoveGadgetColumn(id, 0)
EndIf
If LCase(GetXMLNodeName(node)) = "column"
AddGadgetColumn(id, index,
GetXMLAttribute(node, "text"),
Val(GetXMLAttribute(node, "width")))
index + 1
Else
Break
EndIf
node = NextXMLNode(node)
Wend
index = 0
While node And id > -1
If LCase(GetXMLNodeName(node)) = "item"
item = ReplaceString(GetXMLNodeText(node), "\n", #LF$)
AddGadgetItem(id, index, item)
index + 1
EndIf
node = NextXMLNode(node)
Wend
EndProcedure
;######################################################################
Procedure OpenXMLDialog2(Dialog, xml, Name.s, x, y, w, h, parent)
Protected result
result = OpenXMLDialog(Dialog, xml, Name.s, x, y, w, h, parent)
If result
SearchListIcon(MainXMLNode(xml))
EndIf
ProcedureReturn result
EndProcedure
;######################################################################
Macro OpenXMLDialog(Dialog, xml, Name, x=0, y=0, w=0, h=0, parent=0)
OpenXMLDialog2(Dialog, xml, Name, x, y, w, h, parent)
EndMacro
;######################################################################
Procedure Main()
Protected dialog
Protected xml
Protected xmlstring.s
xmlstring = "<window id='#PB_Any' width='300' height='300' name='test' text='test' flags='#PB_Window_SizeGadget| #PB_Window_ScreenCentered | #PB_Window_SystemMenu'>"+
xmlstring + "<panel>"+
xmlstring + " <tab text='First tab'>"+
xmlstring + " <vbox expand='item:1'>"+
xmlstring + " <listicon id='0' flags='#PB_ListIcon_FullRowSelect'>"+
xmlstring + " <column text='col0' width='150'/>"+
xmlstring + " <column text='col1' width='50'/>"+
xmlstring + " <column text='col2' width='50'/>"+
xmlstring + " <item>Item0\nItem1\nItem2</item>"+
xmlstring + " <item>Item0\nItem1\nItem2</item>"+
xmlstring + " <item>Item0\nItem1\nItem2</item>"+
xmlstring + " <item>Item0\nItem1\nItem2</item>"+
xmlstring + " <item>Item0\nItem1\nItem2</item>"+
xmlstring + " </listicon>"+
xmlstring + " </vbox>"+
xmlstring + " </tab>"+
xmlstring + "</panel>"+
xmlstring + "</window>"
dialog = CreateDialog(#PB_Any)
If dialog
xml = CatchXML(#PB_Any, @xmlstring, StringByteLength(xmlstring));LoadXML(#PB_Any, "ui.xml")
If xml
If OpenXMLDialog(dialog, xml, "", #PB_Ignore, #PB_Ignore)
While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
EndIf
FreeXML(xml)
EndIf
FreeDialog(dialog)
EndIf
EndProcedure:End Main()
Please publish no half measures.
Last edited by hallodri on Wed Aug 28, 2013 6:18 pm, edited 1 time in total.
Re: Questions about the new XmlDialog
Here we go:
Code: Select all
Procedure Main()
Protected dialog
Protected xml
Protected xmlstring.s
xmlstring = "<window id='#PB_Any' width='300' height='300' name='test' text='test' flags='#PB_Window_SizeGadget| #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_Invisible'>"+
"<panel>"+
" <tab text='First tab'>"+
" <listicon id='0' flags='#PB_ListIcon_FullRowSelect'>"+
" </listicon>"+
" </tab>"+
"</panel>"+
"</window>"
dialog = CreateDialog(#PB_Any)
If dialog
xml = CatchXML(#PB_Any, @xmlstring, StringByteLength(xmlstring));LoadXML(#PB_Any, "ui.xml")
If xml
If OpenXMLDialog(dialog, xml, "", #PB_Ignore, #PB_Ignore)
AddGadgetColumn(0, 1, "Column 1", 50)
AddGadgetColumn(0, 2, "Column 2", 50)
AddGadgetColumn(0, 3, "Column 3", 50)
AddGadgetColumn(0, 4, "Column 4", 50)
For k = 0 To 10
AddGadgetItem(0, -1, "Item "+k)
Next
HideWindow(DialogWindow(dialog), #False)
While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
EndIf
FreeXML(xml)
EndIf
FreeDialog(dialog)
EndIf
EndProcedure:End Main()