Sign in to follow this  
Followers 0
BinaryBrother

GUICtrlCreateListView()

3 posts in this topic

#1 ·  Posted (edited)

Func ViewInventory()
$ViewInventory = GUICreate("Inventory View", 600, 440, 193, 125, -1, $WS_EX_ACCEPTFILES)
$listview = GUICtrlCreateListView("Item#    | Product                                          |Usable|Total Unusable", 0, 0, 600, 440,$LVS_NOLABELWRAP,$LVS_EX_GRIDLINES)
$ProductInfo = IniReadSection(@ScriptDir & "\Inventory\Inventory.ini", "Inventory")
For $N = 1 To $ProductInfo[0][0]

I would post the entire thing, but it's 3000+ lines, and those are the relevant lines... lol.

I'm having a terrible time getting the Product Tab over, as you can see by the mass spaces after | Product, which was a failed attempt, but close.. :unsure:

I don't want to expand it every time I was to see the full product name... I've searched and modified all relevant styles, and can't seem to figure it out... Any help is highly appreciated, screen-shot is attached as well... :P

Edited by BinaryBrother

Share this post


Link to post
Share on other sites



BinaryBrother,

Try creating your ListView with simple headers ("Item#|Product|Usable|Total Unusable") and then use _GUICtrlListView_SetColumnWidth with the $LVSCW_AUTOSIZE style. It has worked for me in the past. But be careful or you may end up running out of space in the GUI to show the right hand columns. :-)

If you can accepts a variable sized GUI, there is a way to see how big it would have to be for all columns to fit. You would have to play with this a bit, but the principle is pretty clear:

$iWidth = 0
For $i = 0 To $Last_Col
    GUICtrlSendMsg($hListView, $LVM_SETCOLUMNWIDTH, $i, $LVSCW_AUTOSIZE)
    $iWidth += GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH, $i, 0)
   Next
    
WinMove($hGUI, "", Default, Default, $iWidth + 20)

I hope this helps.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

For some reason I couldn't get the $LVSCW_AUTOSIZE to work... Not syntax error, it just cramped all my columns to like 10px width...

Anyway, I DID however get your CtrlSend to work for a manual resize.

You are truly appreciated!

GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 1, 210)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0