Jump to content

Help - Sizebox Content Dont Fit After Draggin..


 Share

Recommended Posts

hi folks .. i have a stupid problem.

i try make a gui that is resizeable (sizebox) filled with a tab control that contains various controls and lists... problem is.. after resize the window, the tabitem dont has it exactly position.. its flippin in a range of 3-10 pixels after each resizeing... what is the problem?!?!?.. please look at this... im realy helpless...

:

;icludes
#include <Array.au3>
#include <GUIConstants.au3>
#include <Constants.au3>

; default Variablen
Global $scriptname = "Blablabla"
Global $scriptini = @ScriptDir & "\" & $scriptname &  ".ini"

; first run ini
If FileExists($scriptini) = 0 Then
writeini("settings", "scriptname", $scriptname)
writeini("settings", "profileselect", "default")
writeini("profile_default", "profilename", "default")
writeini("profile_default", "window_x", "-1")
writeini("profile_default", "window_y", "-1")
writeini("profile_default", "window_w", "640")
writeini("profile_default", "window_h", "300")
EndIf

; load Variable
Global $profile = readini("settings", "profileselect")
Global $wx = readini("profile_" & $profile, "window_x")
Global $wy = readini("profile_" & $profile, "window_y")
Global $ww = readini("profile_" & $profile, "window_w")
Global $wh = readini("profile_" & $profile, "window_h")

; testcenter
guibuilder()
guicontrol()
Exit

Func guibuilder()

GUICreate($scriptname & " (" & $profile & ")", $ww, $wh, $wx, $wy, BitOR($WS_SIZEBOX,$WS_THICKFRAME,$WS_MINIMIZEBOX,$WS_CLIPSIBLINGS,$WS_SYSMENU))
GUISetFont(8.5, 300)

$tab = GUICtrlCreateTab ( 5, 5, $ww, $wh)
GUICtrlSetResizing ( $tab, 36)

$tab_reclist = GUICtrlCreateTabitem ("tab1")
GUICtrlSetState( -1, $GUI_SHOW)

$tab_options = GUICtrlCreateTabitem ("tab2")

GUICtrlCreateTabitem ("")
GUISetState ()
Return
EndFunc

Func guicontrol()

While 1
$msg = GUIGetMsg(1)
        
If $msg[0] = $GUI_EVENT_CLOSE Then
$win = WinGetPos($msg[1])
If $win[0] >= 1 Then
writeini("profile_" & $profile, "window_x", $win[0])
writeini("profile_" & $profile, "window_y", $win[1])
writeini("profile_" & $profile, "window_w", $win[2]-6)
writeini("profile_" & $profile, "window_h", $win[3]-6)
EndIf
ExitLoop
    
If $msg[0] = $GUI_EVENT_MINIMIZE Then
GUISetState (@SW_MINIMIZE,$msg[1])
EndIf
If $msg[0] = $GUI_EVENT_RESTORE Then
GUISetState (@SW_RESTORE,$msg[1])
EndIf
WEnd
EndFunc

..btw.. writeini and readini are functions and $win[2]-6 and $win[3]-6 is erasing the window borderpixel from wingetpos...

Edited by duketrapp
Link to comment
Share on other sites

Take a look to GUICtrlSetResizing, and adjust to your needs.

o yes man... im so stupid... its 34.. :) ...tnks for the hint..

..for the tab item it works on left and up now.. but not down!!.. and with the other controls its still strange.. i post the full gui part down here... maybe u find somethng i cant... btw.. when i resize the gui the right part moves behind the left list... why?!?!?.. when i close script (wingetpos is stored in ini when closing) and reopen the script all is fine and correct!.... doesent that seems like a bug in the redrawing the window when draggin sizebox?.. hmmm.... ..here is the part of the gui code

GUICreate($scriptname & " (" & $profile & ")", $ww, $wh, $wx, $wy, BitOR($WS_SIZEBOX,$WS_THICKFRAME,$WS_MINIMIZEBOX,$WS_CLIPSIBLINGS,$WS_SYSMENU))
GUISetFont(8.5, 300)

$tab = GUICtrlCreateTab ( 0, 0, $ww, $wh)
GUICtrlSetResizing ( $tab, 34)

$tab1 = GUICtrlCreateTabitem ("tab1")
GUICtrlSetState( -1, $GUI_SHOW)
        
$tab_list = GUICtrlCreateListView ("Bla|Bla|Bla|Bla", 5, 25, $ww-200, $wh-50)
GUICtrlSetResizing ( -1, 34)
        
GUICtrlCreateGroup(" Bla ", $ww-190, 25, 185, $wh-50)
GUICtrlSetResizing ( -1, 256)
$se1 = GUICtrlCreateInput ("Bla", $ww-185, 45, 175, 20)
GUICtrlSetResizing ( -1, 256)
$se2 = GUICtrlCreateCombo ("Bla", $ww-185, 70, 90, 20)
GUICtrlSetResizing ( -1, 256)
$se3 = GUICtrlCreateDate ("", $ww-185, 95, 54, 20, $DTS_TIMEFORMAT)
GUICtrlSetResizing ( -1, 256)
$se4 = GUICtrlCreateDate (@HOUR & ":" & @MIN+1, $ww-185, 120, 54, 20, $DTS_TIMEFORMAT)
GUICtrlSetResizing ( -1, 256)
        
            $DTM_SETFORMAT = 0x1005
            $style = "HH:mm"
            GUICtrlSendMsg( $se3, $DTM_SETFORMAT, 0, $style)
            GUICtrlSendMsg( $se4, $DTM_SETFORMAT, 0, $style)
        
$se5 = GUICtrlCreateInput ("", $ww-185, 145, 50, 20)
GUICtrlSetResizing ( -1, 256)
$se6 = GUICtrlCreateDate ("", $ww-185, 170, 80, 20, $DTS_SHORTDATEFORMAT)
GUICtrlSetResizing ( -1, 256)
$se7 = GUICtrlCreateCombo ("Bla", $ww-185, 195, 75, 20)
GUICtrlSetResizing ( -1, 256)
$se8 = GUICtrlCreateInput ("Bla", $ww-185, 220, 175, 20)
GUICtrlSetResizing ( -1, 256)
$se9 = GUICtrlCreateCombo ("Bla", $ww-185, 245, 75, 20)
GUICtrlSetResizing ( -1, 256)
        
        
$tab2 = GUICtrlCreateTabitem ("tab2")

GUICtrlCreateTabitem ("")
GUISetState ()

.. just the list item should resize its x value at the right side... the group at the right side of the gui schould always have same width... why this is not working?!?!?!... still helpless....

Edited by duketrapp
Link to comment
Share on other sites

you need to play with the docking settings a little more to understand what your doing, I suggest using the variable names, easier to figure out what you have set i.e.

Func guibuilder()
    
    GUICreate($scriptname & " (" & $profile & ")", $ww, $wh, $wx, $wy, BitOR($WS_SIZEBOX, $WS_THICKFRAME, $WS_MINIMIZEBOX, $WS_CLIPSIBLINGS, $WS_SYSMENU))
    GUISetFont(8.5, 300)
    
    $tab = GUICtrlCreateTab(5, 5, $ww, $wh)
    GUICtrlSetResizing($tab, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
    
    $tab_reclist = GUICtrlCreateTabItem("tab1")
    GUICtrlSetState(-1, $GUI_SHOW)
    
    $tab_list = GUICtrlCreateListView("Bla|Bla|Bla|Bla", 5, 25, $ww - 200, $wh - 50)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
    
    GUICtrlCreateGroup(" Bla ", $ww - 190, 25, 185, $wh - 50)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH)
    $se1 = GUICtrlCreateInput("Bla", $ww - 185, 45, 175, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT)
    $se2 = GUICtrlCreateCombo("Bla", $ww - 185, 70, 90, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT)
    $se3 = GUICtrlCreateDate("", $ww - 185, 95, 54, 20, $DTS_TIMEFORMAT)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT)
    $se4 = GUICtrlCreateDate(@HOUR & ":" & @MIN + 1, $ww - 185, 120, 54, 20, $DTS_TIMEFORMAT)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT)
    
    $DTM_SETFORMAT = 0x1005
    $style = "HH:mm"
    GUICtrlSendMsg($se3, $DTM_SETFORMAT, 0, $style)
    GUICtrlSendMsg($se4, $DTM_SETFORMAT, 0, $style)
    
    $se5 = GUICtrlCreateInput("", $ww - 185, 145, 50, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT)
    $se6 = GUICtrlCreateDate("", $ww - 185, 170, 80, 20, $DTS_SHORTDATEFORMAT)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT)
    $se7 = GUICtrlCreateCombo("Bla", $ww - 185, 195, 75, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT)
    $se8 = GUICtrlCreateInput("Bla", $ww - 185, 220, 175, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT)
    $se9 = GUICtrlCreateCombo("Bla", $ww - 185, 245, 75, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT)
    
    $tab_options = GUICtrlCreateTabItem("tab2")
    
    GUICtrlCreateTabItem("")
    GUISetState()
    Sleep(50)
    Return
EndFunc  ;==>guibuilder

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

.. u tested what u post before?... :mellow:

.. the result is still the same.. if do some resizeings with the window the controls dont hold positions... and both, the listbox and the group control dont hold the down positions at $wh - 50 (is full guiheight-50)... this is strange and i dont think the problem is at GUICtrlSetResizing... the listbox must be fix at left and upper side... down it must do dynamic movin with the gui at resizing... and at right it must do same than down but it must leave 200 pixel space to right gui side (thats is $ww - 200)... so... the code should work..but it dont do.. :) ... any usefull hints ahead?.....

..maybe there is a function where i can check over "getmsg" when the window is resized by the user so that i can reset the gui?... i told ya.. when i close script after resizeing and reopen it looks fine with the new positions... strange....

..or maybe i must do this kinda gui with different windows?..like parent and child windows that move together when a user resizes the parent window?...

Edited by duketrapp
Link to comment
Share on other sites

.. u tested what u post before?... :mellow:

.. the result is still the same.. if do some resizeings with the window the controls dont hold positions... and both, the listbox and the group control dont hold the down positions at $wh - 50 (is full guiheight-50)... this is strange and i dont think the problem is at GUICtrlSetResizing... the listbox must be fix at left and upper side... down it must do dynamic movin with the gui at resizing... and at right it must do same than down but it must leave 200 pixel space to right gui side (thats is $ww - 200)... so... the code should work..but it dont do.. :) ... any usefull hints ahead?.....

..maybe there is a function where i can check over "getmsg" when the window is resized by the user so that i can reset the gui?... i told ya.. when i close script after resizeing and reopen it looks fine with the new positions... strange....

..or maybe i must do this kinda gui with different windows?..like parent and child windows that move together when a user resizes the parent window?...

Try using at the top of your script. All controls and buttons should resize in unison

Opt("GUIResizeMode", $GUI_DOCKAUTO)
Link to comment
Share on other sites

GOTCHA!!!! i got it.. :)

..after all gafrost was right with his hint for the docking settings... thnks for the right advise :)

..workin code is

GUICreate($scriptname & " (" & $profile & ")", $ww, $wh, $wx, $wy, BitOR($WS_SIZEBOX,$WS_THICKFRAME,$WS_MINIMIZEBOX,$WS_CLIPSIBLINGS,$WS_SYSMENU))
GUISetFont(8.5, 300)

$tab = GUICtrlCreateTab ( 0, 0, $ww, $wh)
GUICtrlSetResizing ( $tab, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)

$tab1 = GUICtrlCreateTabitem ("tab1")
GUICtrlSetState( -1, $GUI_SHOW)
        
$tab_list = GUICtrlCreateListView ("Bla|Bla|Bla|Bla", 5, 25, $ww-200, $wh-50)
GUICtrlSetResizing ( -1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
        
GUICtrlCreateGroup(" Bla ", $ww-190, 25, 185, $wh-50)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$se1 = GUICtrlCreateInput ("Bla", $ww-185, 45, 175, 20)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$se2 = GUICtrlCreateCombo ("Bla", $ww-185, 70, 90, 20)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$se3 = GUICtrlCreateDate ("", $ww-185, 95, 54, 20, $DTS_TIMEFORMAT)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$se4 = GUICtrlCreateDate (@HOUR & ":" & @MIN+1, $ww-185, 120, 54, 20, $DTS_TIMEFORMAT)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
        
            $DTM_SETFORMAT = 0x1005
            $style = "HH:mm"
            GUICtrlSendMsg( $se3, $DTM_SETFORMAT, 0, $style)
            GUICtrlSendMsg( $se4, $DTM_SETFORMAT, 0, $style)
        
$se5 = GUICtrlCreateInput ("", $ww-185, 145, 50, 20)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$se6 = GUICtrlCreateDate ("", $ww-185, 170, 80, 20, $DTS_SHORTDATEFORMAT)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$se7 = GUICtrlCreateCombo ("Bla", $ww-185, 195, 75, 20)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$se8 = GUICtrlCreateInput ("Bla", $ww-185, 220, 175, 20)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$se9 = GUICtrlCreateCombo ("Bla", $ww-185, 245, 75, 20)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
        
        
$tab2 = GUICtrlCreateTabitem ("tab2")

GUICtrlCreateTabitem ("")
GUISetState ()

..im realy happy.. :mellow: ..

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...