Page 1 of 1

Gadget Item Row Text

Posted: Tue Mar 02, 2010 10:18 pm
by benco5000
I have this code snippet. But I must be trying to set the text in the rows incorrectly.
Any suggestions?
tia

Code: Select all

  ListIconGadget(1, 10, 10, 380, 100, "", 80, #PB_ListIcon_GridLines)
  For a = 0 To 11
    AddGadgetColumn(1, a, "Column " + Str(a), 80)       ;; Add Columns
    SetGadgetItemText(1, -1, "T" + Str(a), a)               ;; set header text
    SetGadgetItemText(1, 0, "T" + Str(a), a)                ;; how do I set row text??
    ;;SetGadgetItemText(1, 1, "T" + Str(a), a)             ;; tried this too
  Next

Re: Gadget Item Row Text

Posted: Tue Mar 02, 2010 10:39 pm
by c4s
Take a look at the helpfile:

Code: Select all

If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
   AddGadgetColumn(0, 1, "Address", 250)
   AddGadgetItem(0, -1, "Harry Rannit"+#LF$+"12 Parliament Way, Battle Street, By the Bay")
   AddGadgetItem(0, -1, "Ginger Brokeit"+#LF$+"130 PureBasic Road, BigTown, CodeCity")
   Repeat
     Event = WaitWindowEvent()
   Until Event = #PB_Event_CloseWindow
 EndIf

Re: Gadget Item Row Text

Posted: Tue Mar 02, 2010 10:42 pm
by jamirokwai
benco5000 wrote:I have this code snippet. But I must be trying to set the text in the rows incorrectly.
Any suggestions?
tia

Code: Select all

  ListIconGadget(1, 10, 10, 380, 100, "", 80, #PB_ListIcon_GridLines)
  For a = 0 To 11
    AddGadgetColumn(1, a, "Column " + Str(a), 80)       ;; Add Columns
    SetGadgetItemText(1, -1, "T" + Str(a), a)               ;; set header text
    SetGadgetItemText(1, 0, "T" + Str(a), a)                ;; how do I set row text??
    ;;SetGadgetItemText(1, 1, "T" + Str(a), a)             ;; tried this too
  Next
If I get the problem right... You need to use AddGadgetItem() to set the cells. Try

Code: Select all

  ListIconGadget(1, 10, 10, 380, 100, "", 80, #PB_ListIcon_GridLines)
  For a = 0 To 11
    AddGadgetColumn(1, a, "Column " + Str(a), 80)       ;; Add Columns
    SetGadgetItemText(1, -1, "T" + Str(a), a)               ;; set header text
    AddGadgetItem(1, 0, "T" + Str(a))                ;; how do I set row text??
    ;;SetGadgetItemText(1, 1, "T" + Str(a), a)             ;; tried this too
  Next

Re: Gadget Item Row Text

Posted: Tue Mar 02, 2010 10:43 pm
by jamirokwai
c4s wrote:Take a look at the helpfile:

Code: Select all

If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
   AddGadgetColumn(0, 1, "Address", 250)
   AddGadgetItem(0, -1, "Harry Rannit"+#LF$+"12 Parliament Way, Battle Street, By the Bay")
   AddGadgetItem(0, -1, "Ginger Brokeit"+#LF$+"130 PureBasic Road, BigTown, CodeCity")
   Repeat
     Event = WaitWindowEvent()
   Until Event = #PB_Event_CloseWindow
 EndIf
You were faster, c4s... :-)