Jump to content
Sign in to follow this  
armoros

[SOLVED] GUIFrame.au3-Avoid dragging ?

Recommended Posts

armoros

After Melba23's guidance how to divide a GUI in two frames i am asking if we can just click on the bar that divides the GUI than to drag it up or down.

Could i use a pre autom. macro/script and then trigger that action from inside the script.

Do i confuse you..tell me to explain better if i do ;)

#include 
#include 
#include 
#include "GUIFrame.au3"
$hGUI = GUICreate("GUI_Parent", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
; Create a 1st level frame
$iFrame = _GUIFrame_Create($hGUI, 1)
_GUIFrame_SetMin($iFrame, 250, 250)
GUISetState(@SW_SHOW)
$hTopFrame = _GUIFrame_GetHandle($iFrame, 1)
_GUIFrame_Switch($iFrame, 1)
GUICtrlCreateLabel("", 0, 0, 0, 0)
$hGUI_Child = GUICreate("GUI_Child", 100, 100, 50, 50, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetBkColor(0xFF0000)
_WinAPI_SetParent($hGUI_Child, $hTopFrame)
GUISetState(@SW_SHOW)
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Edited by armoros

[font="verdana, geneva, sans-serif"] [/font]

Share this post


Link to post
Share on other sites
Melba23

armoros,

Do you mean you want to prevent the resizing of the 2 parts of the GUI? If so then just look at how I create the internal frames within the UDF itself - you can leave out the subclassing code for the separator. :)

Give it a go yourself and come back if you run into difficulties. ;)

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
armoros

Thank you Melba23,i failed to describe what i want.

For example in the script above we have to drag the line up or down a little to grow our frames etc. What i am searching is how to just click on the line and that automatically moves up or down.

like this action in technet site when you click the button that separates the menu from the main page..

Thank you again.


[font="verdana, geneva, sans-serif"] [/font]

Share this post


Link to post
Share on other sites
Melba23

armoros,

Try using a button on the GUI which fires the _GUIFrame_SetSepPos function - something like this:

#include <guiconstantsex.au3>
#include <windowsconstants.au3>
#include <winapi.au3>
#include "GUIFrame.au3"

Global $aSepPos[4] = [2, 100, 200, 300]

$hGUI = GUICreate("GUI_Parent", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

; Create a 1st level frame
$iFrame = _GUIFrame_Create($hGUI, 1)
_GUIFrame_SetSepPos($iFrame, 200)
;_GUIFrame_SetMin($iFrame, 100, 200)
GUISetState(@SW_SHOW)

$hTopFrame = _GUIFrame_GetHandle($iFrame, 1)
_GUIFrame_Switch($iFrame, 1)

GUICtrlCreateLabel("", 0, 0, 0, 0)
$hGUI_Child = GUICreate("GUI_Child", 100, 100, 50, 50, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetBkColor(0xFF0000)
_WinAPI_SetParent($hGUI_Child, $hTopFrame)
GUISetState(@SW_SHOW)

_GUIFrame_Switch($iFrame, 2)
$cButton = GUICtrlCreateButton("Press", 0, 0, 40, 20)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            $aSepPos[0] = Mod($aSepPos[0] + 1, 3)
            _GUIFrame_SetSepPos($iFrame, $aSepPos[$aSepPos[0] + 1])
    EndSwitch
WEnd

How is that? ;)

M23

Edit:

If you want to prevent the separator bar from being dragged manually, you will need to amend the UDF - comment out these

lines:

GUICtrlSetCursor(-1, 11)        ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Line 151

; Subclass the separator        ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Lines 170 to 178
If _GUIFrame_SepSubClass($hSeparator) = 0 Then
   ; If Subclassing failed then delete all GUIs and return error
   GUIDelete($hParent)
    GUIDelete($hSeparator)
    GUIDelete($hFirstFrame)
    GUIDelete($hSecondFrame)
    Return SetError(3, 0, 0)
EndIf
Edited by Melba23
Added code

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
armoros

Melba23 that is what i needed exactly.

Thank you very much for the solution and the 2nd tip

I hope to give something back in the future.

Thank you again Melba ;)

Edited by armoros

[font="verdana, geneva, sans-serif"] [/font]

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  

×