[Implemented] GetGadgetColumWidth, SetGadgetColumnWidth

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

[Implemented] GetGadgetColumWidth, SetGadgetColumnWidth

Post by USCode »

*This request could be addressed by a simple set of general Get/Set functions instead *

Hi Fred,
If the user resizes columns in a ListIconGadget, I would like to be able to get those new column widths later so as I can save them and restore the column widths the next time the user starts up my application.

Please add:
- SetGadgetColumnWidth - Set the column width of a ListIconGadget column dynamically at runtime.
e.g. SetGadgetColumnWidth(#MyGadget, position, width)

- GetGadgetColumnWidth - Get what the current column width is of a ListIconGadget column so as I can save it for later use.
e.g. Width = GetGadgetColumnWidth(#MyGadget,position)


Thanks Fred!
Last edited by USCode on Wed Apr 14, 2004 9:09 pm, edited 1 time in total.
MLK
User
User
Posts: 57
Joined: Sat Jan 24, 2004 8:46 pm
Location: Germany

Post by MLK »

that would be nice!

just because there is a general problem with the columnsizes

Code: Select all

#width=330
a=#width/3
b=#width/3
c=#width/3

If OpenWindow(0, 280, 190, 350, 340,  #PB_Window_SystemMenu |  #PB_Window_TitleBar |#PB_Window_MinimizeGadget, "") 
    neu: 
    If CreateGadgetList(WindowID()) 
        ListIconGadget(0, 10, 30, #width, 290,"1",a) 
        AddGadgetColumn(0,1,"2",b) 
        AddGadgetColumn(0,2,"3",c) 
    EndIf 
EndIf 

Repeat 
    If x=0
        MessageRequester("","each column is #width / 3"+Chr(13)+"but it doesn't fit"+Chr(13)+"look at the scrollbar below") 
        x+1 
        Delay(100) 
    ElseIf x=1
        a-4 
        x+1 
        Delay(100) 
        Goto neu: 
    ElseIf x=2 
        MessageRequester("","width 4 pixel less it fits"+Chr(13)+"(4 columnborders)") 
        x+1 
        Delay(100) 
    ElseIf x=3 
        For i=0 To 50 
            AddGadgetItem(0,i,"one"+Chr(10)+"two"+Chr(10)+"three") 
        Next    
        x+1 
        Delay(100) 
    ElseIf x=4 
        MessageRequester("","but even with this short strings"+Chr(13)+" the srollbar is back!"+Chr(13)+"because of the scrollbar at the right side"+Chr(13)+"but when i reserve the place for the right scrollbar from beginning") 
        x+1 
        c-25 
        Delay(100) 
        Goto neu: 
    ElseIf x=5 
        MessageRequester("","i get 4 columns...") 
        x+1 
        Delay(100) 
  Else 
        MessageRequester("","end") 
        End 
    EndIf 
Until WaitWindowEvent()=#PB_Event_CloseWindow 
i think this is the same in other languages, but its not nice. so a option to resize the columnwidth is nery needed.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

--Kale

Image
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Feature Request: GetGadgetColumWidth, SetGadgetColumnWid

Post by PB »

> Please add:
> SetGadgetColumnWidth - Set the column width of a ListIconGadget
> GetGadgetColumnWidth - Get what the current column width

Yes, would be nice to have this natively. Currently it's done via API calls:

Code: Select all

SendMessage_(GadgetID(#listicongadget),#LVM_SETCOLUMNWIDTH,column,width)
SendMessage_(GadgetID(#listicongadget),#LVM_GETCOLUMNWIDTH,column,0)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

4.0, setting column widths?

Post by USCode »

Does anyone know if this issue has been addressed by any of the enhancements in 4.0? I don't believe it has based on what I can get from the readme?
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Post by USCode »

Looks like the API is still the only way to go with this?
Oh well, maybe some day.
In the meantime, I guess we can always use one of the excellent grids that we now have available.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

I just squeezed these into the next v4 beta:

Code: Select all

GetGadgetItemAttribute(#Gadget, 0, #PB_ListIcon_ColumnWidth, 2)      ; return width of column 2
SetGadgetItemAttribute(#Gadget, 0, #PB_ListIcon_ColumnWidth, 100, 2) ; set width of column 2 to 100
GetGadgetItemText(#Gadget, -1, 2)             ; return header text for column 2
SetGadgetItemText(#Gadget, -1, "New Text", 2) ; change header text for column 2
quidquid Latine dictum sit altum videtur
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I just squeezed these into the next v4 beta

GIMME AN F! GIMME AN R! GIMME AN E! etc... :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Post by USCode »

freak wrote:I just squeezed these into the next v4 beta:
"Houston, the Eagle has landed..." :D

Excellent, thanks Timo!!! This v4 release is blowing my socks off!
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

You realise that we are going to owe Freak a lifetime's supply of pizza for all the work he has done?? And I don't even know if Fred is still alive after these marathon adding sessions. Pretty sure it's a bot in IRC these days due to Fred's body giving up the ghost.

Phew, what a language. I can sit here, bugs or not and crank out handly little things to use after a few minutes and I am as dumb as a rock. Can't do that with other languages.

You guys blokes are dead set legends!
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

PB wrote:GIMME AN F! GIMME AN R! GIMME AN E! etc... :)
:lol:
Post Reply