Sign in to follow this  
Followers 0
mattw112

Listview and GUI resize

5 posts in this topic

#1 ·  Posted (edited)

I'm trying the following code

#include <Array.au3>
#include <GuiStatusBar.au3>
#include <GUIConstants.au3>
#include <GuiListView.au3>

Opt("GuiOnEventMode", True)
Opt("GUICoordMode", 0)

Dim $a_PartsText[2] = ["", ""]
Dim $a_PartsRightEdge[2] = [400, -1]

$Title = "Test"

$GUI = GUICreate($Title, 695, 400, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX))

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Resize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "_Resize")
GUISetOnEvent($GUI_EVENT_RESIZED, "_Resize")
GUISetOnEvent($GUI_EVENT_RESTORE, "_Resize")

$ListView = GUICtrlCreateListView("Item 1|Item 2", -1, -1, 685, 320, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES))
$h_ListView = ControlGetHandle($GUI, "", $ListView)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetResizing($ListView, $GUI_DOCKBORDERS)
 _GUICtrlListViewSetColumnWidth($ListView, 0, 45)

$StatusBar1 = _GUICtrlStatusBarCreate($GUI, $a_PartsRightEdge, $a_PartsText, $SBT_TOOLTIPS)
_GUICtrlStatusBarSetMinHeight($StatusBar1, 35)
GUICtrlSetResizing(-1, $GUI_DOCKSTATEBAR)
GUISetState(@SW_SHOW)

While 1
    Sleep(250)
WEnd

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;
;                           MISC
;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Func _Exit()
    Exit
EndFunc

Func _Resize()
    _GUICtrlListViewSetColumnWidth($ListView, 1, $LVSCW_AUTOSIZE)
    _GUICtrlListViewSetColumnWidth($ListView, 2, $LVSCW_AUTOSIZE_USEHEADER)
    _GUICtrlStatusBarResize($StatusBar1)
EndFunc

The problem I'm having is that if you resize this GUI the listview does not also resize height wise.

I've tried several different GUICtrlSetResizing($ListView, $GUI_DOCKBORDERS) options, but I cant seem to get it to work.

Anyone know what I'm doing wrong?

Also, why does this show up with 3 columns when I've only defined 2 headers?

Thanks,

Terry

Edited by mattw112

Share this post


Link to post
Share on other sites



Hi,

Not sure why, but this fixes it;

GUICtrlSetResizing($StatusBar1, $GUI_DOCKSTATEBAR)oÝ÷ Ù.v'(Z½í¢[¦Æ®¶­sdgVæ2õ&W6¦R£·âôuT7G&ÄÆ7EfWu6WD6öÇVÖåvGFb33c´Æ7EfWrÂÂb33c´Åe45uôUDõ4¤R ôuT7G&ÄÆ7EfWu6WD6öÇVÖåvGFb33c´Æ7EfWrÂÂb33c´Åe45uôUDõ4¤UõU4TTDU" ôuT7G&Å7FGW4&%&W6¦Rb33cµ7FGW4&#¤VæDgVæ2³ÓÒfwCµõ&W6¦P
Best, randall

Share this post


Link to post
Share on other sites

Cool, that does fix it.. and I'm not sure why either. Why setting the option on the status bar fixes the resizing of the list view? Maybe they are tied together somehow.

As for column, when you run this code, I see three columns, 2 with names and a third without a name?

Share this post


Link to post
Share on other sites

Cool, that does fix it.. and I'm not sure why either. Why setting the option on the status bar fixes the resizing of the list view? Maybe they are tied together somehow.

As for column, when you run this code, I see three columns, 2 with names and a third without a name?

But if you do;

_GUICtrlListViewSetColumnWidth($ListView, 1, $LVSCW_AUTOSIZE_USEHEADER)

early on, you see column "1" [ie 2nd col] is the last column; just resize it to fill the remainder;

Best,randall

Share this post


Link to post
Share on other sites

I see now, thanks!

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