Jump to content



Photo

[SOLVED] Bar to divide a Gui ?


  • Please log in to reply
9 replies to this topic

#1 armoros

armoros

  • Active Members
  • PipPipPipPipPipPip
  • 503 posts

Posted 31 May 2012 - 09:47 PM

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


AutoIt         
#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, 02 June 2012 - 03:29 PM.






#2 JScript

JScript

    Goodbye everybody, I got tired of this system adopted here!

  • Active Members
  • PipPipPipPipPipPip
  • 1,062 posts

Posted 31 May 2012 - 10:20 PM

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://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#3 armoros

armoros

  • Active Members
  • PipPipPipPipPipPip
  • 503 posts

Posted 31 May 2012 - 11:38 PM

Hello JScript

Yes something like that my friend ..
But after a better search i found this topic 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, 31 May 2012 - 11:45 PM.


#4 JScript

JScript

    Goodbye everybody, I got tired of this system adopted here!

  • Active Members
  • PipPipPipPipPipPip
  • 1,062 posts

Posted 31 May 2012 - 11:47 PM

Try this:
AutoIt         
#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://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#5 armoros

armoros

  • Active Members
  • PipPipPipPipPipPip
  • 503 posts

Posted 01 June 2012 - 12:03 AM

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

#6 JScript

JScript

    Goodbye everybody, I got tired of this system adopted here!

  • Active Members
  • PipPipPipPipPipPip
  • 1,062 posts

Posted 01 June 2012 - 12:14 AM

I'll modify the code turning into an UDF to make our lives easier!

Regards,

João Carlos.
http://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#7 guinness

guinness

    guinness

  • MVPs
  • 10,372 posts

Posted 01 June 2012 - 10:25 AM

What about this too >> GUI Frame UDF

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#8 armoros

armoros

  • Active Members
  • PipPipPipPipPipPip
  • 503 posts

Posted 01 June 2012 - 11:31 AM

What about this too >> GUI Frame UDF


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

#9 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,373 posts

Posted 01 June 2012 - 11:49 AM

armoros,

I can not do it this with Gui Frame.UDF

But I can: :)
AutoIt         
#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
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#10 armoros

armoros

  • Active Members
  • PipPipPipPipPipPip
  • 503 posts

Posted 01 June 2012 - 12:06 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users