Possible bug with listicon detected

Just starting out? Need help? Post your questions and find answers here.
menschmarkus
Posts: 54
Joined: Thu Apr 10, 2014 3:35 pm

Possible bug with listicon detected

Post by menschmarkus »

Hi,
possibly I found a bug.
If you generate a window which contains a listicon gadget the first column always does not accept the width given in the definition. The command line

Code: Select all

AddGadgetCoulum(#mylisticon,-1,"headline",50) 
as a first column ignores the width 50.
Even if you change the Attribute with

Code: Select all

SetGadgetItemAttribute(#mylisticon,0,#PB_ListIcon_Columnwidth,50,0)
the size of the first column does not accept the new value.
as soon you do it right, it works !
Fred
Site Admin
Posts: 1820
Joined: Mon Feb 24, 2014 10:51 am

Re: Possible bug with listicon detected

Post by Fred »

Please always post a small working snippet to help us to reproduce.
menschmarkus
Posts: 54
Joined: Thu Apr 10, 2014 3:35 pm

Re: Possible bug with listicon detected

Post by menschmarkus »

Sorry
here it is:

Code: Select all

Runtime Enumeration 
  #window1
  #listicon_1
EndEnumeration
#xml = 0

; __________ Dialog XML Source __________
XML$ = ~"<dialogs>\n"
XML$ + ~"  <window name='window1' flags='#PB_Window_ScreenCentered|#PB_Window_WindowCentered' text='ListIcon bug' minwidth='640' minheight='480' maxwidth='640' maxheight='480' id='#window1'>\n"
XML$ + ~"    <listicon flags='#PB_ListIcon_GridLines' id='#listicon_1'/>\n"
XML$ + ~"  </window>\n"
XML$ + ~"</dialogs>\n"
XML$ + ~""
;__________ Create and open Window __________
If ParseXML(#xml, XML$) And XMLStatus(#xml) = #PB_XML_Success
  If CreateDialog(#window1) And OpenXMLDialog(#window1,0,"window1")
;__________ Add Columns __________
    AddGadgetColumn(#listicon_1,-1,"first",50)
    AddGadgetColumn(#listicon_1,-1,"Second",100)
    AddGadgetColumn(#listicon_1,-1,"Third",100)  
  Else
    Debug DialogError(#window1)
  EndIf
Else
  Debug XMLError(#xml)
EndIf
;__________ Fill Listicon __________
For i.i = 1 To 10
  AddGadgetItem(#listicon_1,-1,Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i))
Next
;__________ Resize first column __________
SetGadgetItemAttribute(#listicon_1,0,#PB_ListIcon_ColumnWidth,50,0)
as soon you do it right, it works !
menschmarkus
Posts: 54
Joined: Thu Apr 10, 2014 3:35 pm

Re: Possible bug with listicon detected

Post by menschmarkus »

I extendet code snippes so you can see it better:

Code: Select all

Runtime Enumeration 
  #window1
  #listicon_1
  #button_resize
EndEnumeration
#xml = 0

Global EvenOdd.i = 0

; __________ Dialog XML Source __________
XML$ = ~"<dialogs>\n"
XML$ + ~"  <window name='window1' flags='#PB_Window_ScreenCentered|#PB_Window_WindowCentered' text='ListIcon bug' minwidth='640' minheight='480' maxwidth='640' maxheight='480' id='#window1'>\n"
XML$ + ~"    <vbox expand='item:1'>\n"
XML$ + ~"      <listicon flags='#PB_ListIcon_GridLines' id='#listicon_1' title='First' titlewidth='50'/>\n"
XML$ + ~"      <button text='change column width ' id='#button_resize'/>\n"
XML$ + ~"    </vbox>\n"
XML$ + ~"  </window>\n"
XML$ + ~"</dialogs>\n"
XML$ + ~"";__________ Create and open Window __________
If ParseXML(#xml, XML$) And XMLStatus(#xml) = #PB_XML_Success
  If CreateDialog(#window1) And OpenXMLDialog(#window1,0,"window1")
;__________ Add Columns __________
    AddGadgetColumn(#listicon_1,-1,"first",50)
    AddGadgetColumn(#listicon_1,-1,"Second",100)
    AddGadgetColumn(#listicon_1,-1,"Third",100)  
  Else
    Debug DialogError(#window1)
  EndIf
Else
  Debug XMLError(#xml)
EndIf
;__________ Fill Listicon __________
For i.i = 1 To 10
  AddGadgetItem(#listicon_1,-1,Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i))
Next

Procedure HandleEventGadget()
  Debug EvenOdd
  Select EventGadget()
    Case #button_resize
      If EvenOdd = 0
        SetGadgetItemAttribute(#listicon_1,0,#PB_ListIcon_ColumnWidth,50,0)
        SetGadgetItemAttribute(#listicon_1,1,#PB_ListIcon_ColumnWidth,100,1)      
        EvenOdd = 1
      Else
        SetGadgetItemAttribute(#listicon_1,0,#PB_ListIcon_ColumnWidth,100,0)
        SetGadgetItemAttribute(#listicon_1,1,#PB_ListIcon_ColumnWidth,50,1)        
        EvenOdd = 0
      EndIf
  EndSelect
EndProcedure

BindEvent(#PB_Event_Gadget,@HandleEventGadget())
;__________ Resize first column __________
as soon you do it right, it works !
Post Reply