Jump to content

[SOLVED] Bar to divide a Gui ?


Recommended Posts

Sorry if the title is wrong but i didn't knew how to describe it...

Well i would like to learn how it is possible to have in one Gui a line or something that separates the Gui in two parts. something like Melbas23 frames.udf. But when we embed an app. and maximize it to open only in the upper part of the Gui.

For example in the script bellow is a Gui in which i embed a simple bat file but when i maximize it i wanted it to grow only in the upper part of the Gui so to avoid other controls to be overlapped by the embedded app. (bat file).

Is that possible guys ?

screen shot example post-71357-0-88975700-1338500727_thumb.p

#include 
#include 
$hGUI = GUICreate("Test", 800, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
$PID    = Run("C:\Documents and Settings\George\Desktop\exams\Autoit_3.3.8.1\Test Scripts\admin.bat", "", @SW_HIDE)
$hWnd   = 0
$stPID  = DllStructCreate("int")
Do
$WinList = WinList()
    For $i = 1 To $WinList[0][0]
        If $WinList[$i][0] <> "" Then
            DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID))
            If DllStructGetData($stPID, 1) = $PID Then
                $hWnd = $WinList[$i][1]
                ExitLoop
            EndIf
        EndIf
    Next
    Sleep(100)
Until $hWnd <> 0
$stPID = 0
If $hWnd <> 0 Then
    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20)
    $nExStyle = $nExStyle[0]
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $hGUI)
    WinSetState($hWnd, "", @SW_SHOW)
    WinMove($hWnd, "", 0, 0, 600, 400)
EndIf
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
WEnd
Edited by armoros

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

Link to comment
Share on other sites

Like JSplitPane (java)?

Example:

Posted Image

Link: http://docs.oracle.com/javase/tutorial/uiswing/components/splitpane.html

A long time ago I try to do the same!!! ;)

Regards,

João Carlos.

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Hello JScript

Yes something like that my friend ..

But after a better search that i thing it does what we want but it has a lot of errors to me.

Probably with your experience you can fix it . ;)

Edited by armoros

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

Link to comment
Share on other sites

Try this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>
#include <StaticConstants.au3>
#include <GuiStatusbar.au3>

;===============================================================================
; FileName:         splitterdemo.au3
; Description:    Splitter Bar demo
;
; Requirement:    Beta;!!! with this version beta is not required
; Author(s):        eltorro (Steve Podhajecki <gehossafats@netmdc.com>) modified by Tresa
; Note(s):          This is just a proof of concept at the moment.
;                   This could be tweaked into a udf with a little more work
;                   The basic principle is to create a pic box or label and drag it
;                   then resize the controls.
;                   I bowwored some filler for the tree and list from the help files.
;===============================================================================
;$WM_SIZE =0x0005
Global $Form1Height = 448
Global $Form1Width = 622
Global $splitWidth = 5
Global $leftVSplit = 144
Global $topHSplit = 320
Global $topMargin = 6
Global $leftMargin = 4
Global $rigthMargin = 4
Global $bottomMargin = 6
Global $statusBarHeight

$Form1 = GUICreate("Splitter Demo", $Form1Width, $Form1Height, 192, 125, BitOR($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))

$TreeView1 = GUICtrlCreateTreeView($leftMargin, $topMargin, $leftVSplit - $leftMargin, $topHSplit - $topMargin, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $TreeView1)
GUICtrlSetColor(-1, 0x0000C0)
$displayitem = GUICtrlCreateTreeViewItem("Display", $TreeView1)
GUICtrlSetColor(-1, 0x0000C0)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
GUICtrlSetState($generalitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "General"-item and paint in bold
GUICtrlSetState($displayitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "Display"-item and paint in bold


$ListView1 = GUICtrlCreateListView("col1  |col2|col3  ", $leftVSplit + $splitWidth, $topMargin, $Form1Width - $rigthMargin - ($leftVSplit + $splitWidth), $topHSplit - $topMargin, -1, $WS_EX_CLIENTEDGE)
$item1 = GUICtrlCreateListViewItem("item2|col22|col23", $ListView1)
$item2 = GUICtrlCreateListViewItem("item1|col12|col13", $ListView1)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33", $ListView1)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping
GUISetState()
GUICtrlSetData($item2, "ITEM1")
GUICtrlSetData($item3, "||COL33")

;horizontal divider.
$Pic2 = GUICtrlCreatePic("", $leftMargin, $topHSplit, $Form1Width - $leftMargin - $rigthMargin, $splitWidth, $SS_NOTIFY);!!! BitOR($SS_NOTIFY, $SS_ETCHEDFRAME), $WS_EX_CLIENTEDGE)
GUICtrlSetCursor($Pic2, 11)

;vertical divider
$Pic1 = GUICtrlCreateLabel("", $leftVSplit, $topMargin, $splitWidth, $topHSplit - $topMargin, $SS_NOTIFY)
GUICtrlSetCursor($Pic1, 13)

;statusBar
Local $a[3] = [150, 350, -1]
Local $b[3] = ["Ready.", "", ""], $DragCtrl = ""
$Status1 = _GuiCtrlStatusBar_Create($Form1, $a, $B)
Local $a_rect = _GUICtrlStatusBar_GetRect($Status1, 1)
$statusBarHeight = ($a_rect[3] - $a_rect[1])

$Edit1 = GUICtrlCreateEdit("", $leftMargin, $topHSplit + $splitWidth, $Form1Width - $leftMargin - $rigthMargin, $Form1Height - $bottomMargin - $statusBarHeight - $topHSplit - $splitWidth, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetData($Edit1, "Drag the bars between the controls and they will resize." & @CRLF & _
        "Resize the screen and see what happens." & @CRLF & _
        "The Status bar show True the left mouse button is down and over a splitter.")

Opt("MouseCoordMode", 2)

GUISetState(@SW_SHOW)
Dim $precedingMsg, $stopTime
ResizeControls()
GUIRegisterMsg($WM_SIZE, "RESIZE_CONTROLS")
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_PRIMARYDOWN
            _GuiCtrlStatusBar_SetText($Status1, "Primary Down", 0)
        Case $msg = $Pic1
            If $DragCtrl = "" Then _GuiCtrlStatusBar_SetText($Status1, "Pic1 Primary Down", 0)
            $DragCtrl = $Pic1

        Case $msg = $Pic2
            _GuiCtrlStatusBar_SetText($Status1, "Pic2 Primary Down", 0)
            $DragCtrl = $Pic2
        Case $msg = $GUI_EVENT_PRIMARYUP
            _GuiCtrlStatusBar_SetText($Status1, "Primary Up", 0)
            saveSplitPos()
            _GuiCtrlStatusBar_SetText($Status1, "", 1)
            Select
                Case $DragCtrl = $Pic1
                    SplitterVert($TreeView1, $ListView1, $Pic1, $Pic2)
                    $DragCtrl = ""
                Case $DragCtrl = $Pic2
                    SplitterHort($TreeView1, $ListView1, $Edit1, $Pic2)
                    $DragCtrl = ""
            EndSelect

        Case $msg = $GUI_EVENT_SECONDARYDOWN
            _GuiCtrlStatusBar_SetText($Status1, "Secondary Down", 0)
        Case $msg = $GUI_EVENT_SECONDARYUP
            _GuiCtrlStatusBar_SetText($Status1, "Secondary Up", 0)
        Case $msg = $GUI_EVENT_MOUSEMOVE
            $stopTime = TimerInit()
            If $DragCtrl <> "" Then
                _GuiCtrlStatusBar_SetText($Status1, "Dragging", 1)
                Local $picpos = ControlGetPos("", "", $DragCtrl)
                Local $mousepos = MouseGetPos()
                Local $winpos = WinGetClientSize("")
                If $DragCtrl = $Pic1 Then
                    If $mousepos[0] > 25 And $mousepos[0] < ($winpos[0] - 25) Then GUICtrlSetPos($Pic1, $mousepos[0], $picpos[1], 2)
                EndIf
                If $DragCtrl = $Pic2 Then
                    If $mousepos[1] > 25 And $mousepos[1] < ($winpos[1] - 25) Then GUICtrlSetPos($Pic2, $picpos[0], $mousepos[1], $picpos[2], 2)
                EndIf
            Else
                _GuiCtrlStatusBar_SetText($Status1, "Mouse Move", 0)
            EndIf
        Case $msg = $GUI_EVENT_RESIZED Or $msg = $GUI_EVENT_MAXIMIZE Or $msg = $GUI_EVENT_RESTORE;!!!
            ResizeControls()
            saveSplitPos()

        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
            $idleTime = TimerDiff($stopTime)
            If $idleTime > 100 Then
                $stopTime = TimerInit()
                If $DragCtrl <> "" Then
                    _GuiCtrlStatusBar_SetText($Status1, "Idling", 1)
                Else
                    _GuiCtrlStatusBar_SetText($Status1, "Idling", 0)
                EndIf
            EndIf
    EndSelect
WEnd
Exit

Func saveSplitPos()
    Local $winpos = WinGetClientSize("")
    $Form1Width = $winpos[0]
    $Form1Height = $winpos[1]
    Local $splitpos1 = ControlGetPos("", "", $Pic1)
    $leftVSplit = $splitpos1[0]
    Local $splitpos2 = ControlGetPos("", "", $Pic2)
    $topHSplit = $splitpos2[1]
EndFunc   ;==>saveSplitPos

Func RESIZE_CONTROLS($hWnd, $msg, $wParam, $lParam)
    Local $winpos = WinGetClientSize("")
    Local $Hcoef = ($winpos[0] - $leftMargin - $rigthMargin - $splitWidth) / ($Form1Width - $leftMargin - $rigthMargin - $splitWidth)
    Local $Vcoef = ($winpos[1] - $topMargin - $bottomMargin - $splitWidth - $statusBarHeight) / ($Form1Height - $topMargin - $bottomMargin - $splitWidth - $statusBarHeight)

    GUICtrlSetPos($Pic2, $leftMargin, $topMargin + ($topHSplit - $topMargin) * $Vcoef, $winpos[0])
    GUICtrlSetPos($Pic1, $leftMargin + ($leftVSplit - $leftMargin) * $Hcoef, $topMargin, $splitWidth, ($topHSplit - $topMargin) * $Vcoef)

    ResizeControls()
    Return $GUI_RUNDEFMSG
EndFunc   ;==>RESIZE_CONTROLS

Func ResizeControls()
    _GuiCtrlStatusBar_Resize($Status1)

    SplitterHort($TreeView1, $ListView1, $Edit1, $Pic2)
    SplitterVert($TreeView1, $ListView1, $Pic1, $Pic2)
EndFunc   ;==>ResizeControls

Func SplitterVert($ctrl1, $ctrl2, $split1, $iop)
    GUICtrlSetState($split1, $gui_hide);!!!
    Local $splitpos1 = ControlGetPos("", "", $split1)
    Local $winpos = WinGetClientSize("")

    GUICtrlSetPos($split1, $splitpos1[0], $splitpos1[1], $splitWidth, $splitpos1[3]);!!!

    GUICtrlSetPos($ctrl1, $leftMargin, $splitpos1[1], _
            ($splitpos1[0] - $leftMargin), _
            $splitpos1[3])

    GUICtrlSetPos($ctrl2, $splitpos1[0] + $splitWidth, _
            $splitpos1[1], _
            $winpos[0] - $rigthMargin - $splitpos1[0] - $splitWidth, _
            $splitpos1[3])
    GUICtrlSetState($split1, $gui_show);!!!
EndFunc   ;==>SplitterVert

Func SplitterHort($ctrl1, $ctrl2, $ctrl3, $split)
    Local $splitpos = ControlGetPos("", "", $split)
    Local $splitpic1 = ControlGetPos("", "", $Pic1);!!!
    $splitpos[3] = $splitWidth
    GUICtrlSetPos($split, $splitpos[0], $splitpos[1], $splitpos[2], $splitWidth);!!!
    GUICtrlSetState($split, $gui_hide);!!!

    Local $winpos = WinGetClientSize("")

    Local $nh
    $nh = $splitpos[1] - $topMargin;jcd - 9

    GUICtrlSetPos($ctrl1, $leftMargin, $topMargin, $splitpic1[0] - $leftMargin, $nh)
    GUICtrlSetPos($ctrl2, $splitpic1[0] + $splitWidth, $topMargin, $winpos[0] - $rigthMargin - ($splitpic1[0] + $splitWidth), $nh)

    Local $top = $splitpos[1] + $splitWidth
    GUICtrlSetPos($Pic1, $splitpic1[0], $splitpic1[1], $splitpic1[2], $nh);!!!

    $nh = $winpos[1] - $top - $bottomMargin - $statusBarHeight; move this up above the status bar

    GUICtrlSetPos($ctrl3, $leftMargin, _
            $top, _
            $winpos[0] - $leftMargin - $rigthMargin, _
            $nh)

    GUICtrlSetState($split, $gui_show);!!!
EndFunc   ;==>SplitterHort

Regards,

João Carlos.

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Yea that it is great JScript now it works fine...;)

But as i checked an embedded app inside it does not seem to work as i want...

Thank you my friend for the assistance

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

Link to comment
Share on other sites

What about this too >>

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

What about this too >>

Yes guinness that is great also, but i am trying to found how to make an embedded external application ie.-regedit- to maximized only in the upper part of the GUI..

I can not do it this with Gui Frame.UDF.

Thank you

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

Link to comment
Share on other sites

  • Moderators

armoros,

I can not do it this with Gui Frame.UDF

But I can: :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

#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

Any help? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

armoros,

But I can: :)

Ahh...Melba23 that is exactly what i wanted, that is beautiful man, i couldn't make it work...

I should try more before i speak(type) ;)

Thanks Melba23,JScript and guinness...now i can move on..

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

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...