CreateDialog - ListIconGadget: how to add columns?

Just starting out? Need help? Post your questions and find answers here.
Dirk Geppert
Posts: 332
Joined: Fri Sep 22, 2017 7:02 am

CreateDialog - ListIconGadget: how to add columns?

Post by Dirk Geppert »

Hi guys, I want to create a listicongadget with several columns. What am I doing wrong?

Code: Select all

 <listicon height='80' text='First Column' id='#ListIcon'>" +
       "            <column text='Second' width='100'/>" +
       "            <column text='Third' width='200'/>" +
       "        </listicon> " +

Code: Select all

Enumeration
  #Dialog2
EndEnumeration

Runtime Enumeration Gadget
  #ListIcon
EndEnumeration

#Xml = 0


Procedure CreateDialogGeneric(Dialog, XML$, x, y)
  If ParseXML(#Xml, XML$) And XMLStatus(#Xml) = #PB_XML_Success
  
    If CreateDialog(Dialog) And OpenXMLDialog(Dialog, #Xml, "test", x, y) = #False
      Debug "Dialog error: " + DialogError(Dialog)
    EndIf
  Else
    Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
  EndIf  
EndProcedure

XML$ = "<window id='#PB_Any' name='test' text='All Gadgets' minwidth='600' minheight='600' flags='#PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
       "        <hbox>" +
       "          <listicon height='80' text='First Column' id='#ListIcon'>" +
       "            <column text='Second' width='100'/>" +
       "            <column text='Third' width='200'/>" +
       "        </listicon> " +
       "        </hbox>" +
       "</window>"

CreateDialogGeneric(#Dialog2, XML$, 370, 10)
menschmarkus
Posts: 54
Joined: Thu Apr 10, 2014 3:35 pm

Re: CreateDialog - ListIconGadget: how to add columns?

Post by menschmarkus »

As I know you cannot add ListIcon Columns within XML Source. You need to add them after window is established.

Try this

Code: Select all

Enumeration
  #Dialog2
EndEnumeration

Runtime Enumeration Gadget
  #ListIcon
EndEnumeration

#Xml = 0


Procedure CreateDialogGeneric(Dialog, XML$, x, y)
  If ParseXML(#Xml, XML$) And XMLStatus(#Xml) = #PB_XML_Success
  
    If CreateDialog(Dialog) And OpenXMLDialog(Dialog, #Xml, "test", x, y) = #False
      Debug "Dialog error: " + DialogError(Dialog)
    EndIf
  Else
    Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
  EndIf  
EndProcedure

XML$ = "<window id='#PB_Any' name='test' text='All Gadgets' minwidth='600' minheight='600' flags='#PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
       "        <hbox>" +
       "          <listicon height='80' text='First Column' id='#ListIcon'/>" +
       "        </hbox>" +
       "</window>"

CreateDialogGeneric(#Dialog2, XML$, 370, 10)
AddGadgetColumn(#ListIcon,1,"Second",100)
AddGadgetColumn(#ListIcon,2,"Third",200)
as soon you do it right, it works !
Post Reply