Page 1 of 1

ListIconGadget + Wordwrap

Posted: Wed Jun 29, 2011 10:06 am
by captain_skank
Morning All,

I use the followng call to wordwrap text in a listicongadget :

SendMessage_(GadgetID(#fld_8010_t9_table), #EM_SETTARGETDEVICE, #Null, 0)

This will wordwrap text that is longer than the width of the column in the listicongadget, except if the text contains carriage returns, when it will just ignore everything after that point.

Anybody know a way around this or if this is even the right call ??

The listicongadget could really do with upgrading to include wordwrapping,rowheight and column sorting options imho. :oops:

Cheers

Re: ListIconGadget + Wordwrap

Posted: Wed Jun 29, 2011 1:37 pm
by IdeasVacuum
According to MSDN, you do have the correct SendMessage.

http://msdn.microsoft.com/en-us/library ... 85%29.aspx

It sounds as though the ListIcon cells are being filled/updated programmatically in your app? If that is the case, then perform a String Replace first and replace the #CRLF$ chars with space chars.

Re: ListIconGadget + Wordwrap

Posted: Wed Jun 29, 2011 1:53 pm
by RASHAD
captain_skank Hi
I think what you need is to increase the line height
Then you can insert word wrap text and at the same time you can use chr(13) as a Return

Code: Select all

If OpenWindow(0, 0, 0, 640, 440,"WordWrap Demo",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  ListIconGadget(0, 10, 10, 620, 420, "Column 0", 220,#PB_ListIcon_FullRowSelect|#PB_ListIcon_GridLines)
  LoadFont(0, "Tahoma", 12 )
  SetGadgetFont(0, FontID(0))
  Texth = SendMessage_(GadgetID(0), #LVM_GETITEMSPACING, 1, 0) >> 16 - 4
  AddGadgetColumn(0, 1, "Column 1", 150)
  imageList = ImageList_Create_(1, 5*Texth, #ILC_COLOR32 | #ILC_MASK, 0, 0) ;for 5 lines
  SendMessage_(GadgetID(0), #LVM_SETIMAGELIST, #LVSIL_SMALL, imageList)
  
  For x=1 To 4 
    AddGadgetItem(0,-1, "This is a wordwrap text demonstration in a ListIcon Gadget  " + Chr(13) + "This is a separate line" + Chr(10) + "Line 1" + Chr(13) + "Line 2" + Chr(13) + "Line 3" + Chr(13) + "Line 4" + Chr(13) ) 
  Next
  
 
  Repeat 
    event = WaitWindowEvent() 
    Select event 
      Case #PB_Event_Gadget 
        Select EventGadget() 
          Case 0

        EndSelect 
    EndSelect 
  Until event = #PB_Event_CloseWindow 
EndIf 
End 


Re: ListIconGadget + Wordwrap

Posted: Thu Nov 02, 2023 4:19 pm
by MarcoAb
Hi, I use this trick often. Thanks. Is there a possibility to display more than 255 characters in a single column?

Thanks in advance

Marco

Re: ListIconGadget + Wordwrap

Posted: Fri Nov 03, 2023 12:58 am
by jacdelad
On Windows the ListIconGadget is basically a ListView-Control. According to Microsoft:
The Text property allows you to change the text displayed for the item. The text of the ListViewItem should not exceed 259 characters or unexpected behavior could occur.
https://learn.microsoft.com/en-us/dotne ... wItem_Text
This applies to the ListViews created via API and the .net-Framework.

Quoting Peter Huang from Microsoft about the cause:
Why the length of the text of listview item is limited to 259 character is
because that the listview is design for display collection of objects like
files and not for general purpose control. So it is similar to the filename
length limitation in the windows file system's MAX_PATH.
https://bytes.com/topic/visual-basic-ne ... lumn-sizes

Re: ListIconGadget + Wordwrap

Posted: Fri Nov 03, 2023 10:26 am
by MarcoAb
Ok . Got it.
Thanks

Re: ListIconGadget + Wordwrap

Posted: Fri Nov 03, 2023 6:08 pm
by jacdelad
But to be honest, in my opinion, 259 characters is a bit low for a control with so much power and customizations.