Sign in to follow this  
Followers 0
Chewbi

advanced resizing problem

8 posts in this topic

Hello,

I have an advanced resizing problem.

I want the combo2 goes down at the same time that the editbox but it doesn't work.

I want also that listview1 fits in height and listview2 in height and width.

It's a bug or an error on my code ?

thank you for your help.

 

#include <GUIConstants.au3>
#include <GuiComboBoxEx.au3>

$gui = GUICreate("GUI", 1003, 664, 20, 0,BitOR($WS_SIZEBOX,$WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER))
$combo1 = GUICtrlCreateCombo("Combo", 6, 8, 227, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)
$listview1 = GUICtrlCreateListView("Test", 6, 35, 227, 530)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)
$combo2 = _GUICtrlComboBoxEx_Create($gui, "Combo2", 6, 574, 227, 200,$CBS_DROPDOWNLIST)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH)
$listview2 = GUICtrlCreateListView("Test2", 240, 6, 755, 559)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKRIGHT)
$editbox = GUICtrlCreateEdit("", 240, 574, 674, 84)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKRIGHT)
$button = GUICtrlCreateButton("Button", 923, 574, 73, 84)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)

GUISetState(@SW_SHOW, $gui)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

1) if you want to use GUICtrlSetResizing() then use native AutoIt's controls, not UDF ones

;~ $combo2 = _GUICtrlComboBoxEx_Create($gui, "Combo2", 6, 574, 227, 200, $CBS_DROPDOWNLIST)
;~ GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH)
$combo2 = GUICtrlCreateCombo("Combo2", 6, 574, 227, 200, $CBS_DROPDOWNLIST)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH)

 

2) if you really need UDF controls and not native ones then you have to do resizing of such controls yourself in WM_SIZE event

GUIRegisterMsg($WM_SIZE, "WM_SIZE")

Func WM_SIZE()
    GUICtrlSetPos(...)
    Return $GUI_RUNDEFMSG
EndFunc
Edited by Zedna
1 person likes this

Share this post


Link to post
Share on other sites

 

I want also that listview1 fits in height and listview2 in height and width.

 

$listview1 = GUICtrlCreateListView("Test", 6, 35, 227, 530)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150)
;~ GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH)

Share this post


Link to post
Share on other sites

Tanks but the problem is the same with only native AutoIt's controls :

#include <GUIConstants.au3>

$gui = GUICreate("GUI", 1003, 664, 20, 0,BitOR($WS_SIZEBOX,$WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER))
$combo1 = GUICtrlCreateCombo("Combo", 6, 8, 227, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)
$listview1 = GUICtrlCreateListView("Test", 6, 35, 227, 530)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)
$combo2 = GUICtrlCreateCombo( "Combo2", 6, 574, 227, 200,$CBS_DROPDOWNLIST)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH)
$listview2 = GUICtrlCreateListView("Test2", 240, 6, 755, 559)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKRIGHT)
$editbox = GUICtrlCreateEdit("", 240, 574, 674, 84)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKRIGHT)
$button = GUICtrlCreateButton("Button", 923, 574, 73, 84)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)

GUISetState(@SW_SHOW, $gui)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

 

1) if you want to use GUICtrlSetResizing() then use native AutoIt's controls, not UDF ones

;~ $combo2 = _GUICtrlComboBoxEx_Create($gui, "Combo2", 6, 574, 227, 200, $CBS_DROPDOWNLIST)
;~ GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH)
$combo2 = GUICtrlCreateCombo("Combo2", 6, 574, 227, 200, $CBS_DROPDOWNLIST)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH)

2) if you really need UDF controls and not native ones then you have to do resizing of such controls yourself in WM_SIZE event

GUIRegisterMsg($WM_SIZE, "WM_SIZE")

Func WM_SIZE()
    GUICtrlSetPos(...)
    Return $GUI_RUNDEFMSG
EndFunc

Share this post


Link to post
Share on other sites
$listview1 = GUICtrlCreateListView("Test", 6, 35, 227, 530)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150)
;~ GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) 

 

ok but combo2 not go down at the same time that the editbox.

#include <GUIConstants.au3>

$gui = GUICreate("GUI", 1003, 664, 20, 0,BitOR($WS_SIZEBOX,$WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER))
$combo1 = GUICtrlCreateCombo("Combo", 6, 8, 227, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)
$listview1 = GUICtrlCreateListView("Test", 6, 35, 227, 530)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH)
$combo2 = GUICtrlCreateCombo( "Combo2", 6, 574, 227, 200,$CBS_DROPDOWNLIST)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH)
$listview2 = GUICtrlCreateListView("Test2", 240, 6, 755, 559)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKRIGHT)
$editbox = GUICtrlCreateEdit("", 240, 574, 674, 84)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKRIGHT)
$button = GUICtrlCreateButton("Button", 923, 574, 73, 84)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)

GUISetState(@SW_SHOW, $gui)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Answer and solution is in my first post in this topic.

Copy my code snippet and replace your bad GUICtrlSetResizing() ...

 

sorry !

it's perfect but I don't understand why combo2 have $GUI_DOCKBOTTOM (and not $GUI_DOCKTOP) and mainly $GUI_DOCKHEIGHT (and not $GUI_DOCKBOTTOM)  ??

#include <GUIConstants.au3>

$gui = GUICreate("GUI", 1003, 664, 20, 0,BitOR($WS_SIZEBOX,$WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER))
$combo1 = GUICtrlCreateCombo("Combo", 6, 8, 227, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)
$listview1 = GUICtrlCreateListView("Test", 6, 35, 227, 530)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH)
$combo2 = GUICtrlCreateCombo( "Combo2", 6, 574, 227, 200,$CBS_DROPDOWNLIST)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH)
$listview2 = GUICtrlCreateListView("Test2", 240, 6, 755, 559)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKRIGHT)
$editbox = GUICtrlCreateEdit("", 240, 574, 674, 84)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKRIGHT)
$button = GUICtrlCreateButton("Button", 923, 574, 73, 84)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH)

GUISetState(@SW_SHOW, $gui)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

I imagine it is because an Edit box is a very different type of control to a Combo.

Have a think about the differences.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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