Sign in to follow this  
Followers 0
philw

Controls in a window

2 posts in this topic

I'm trying to create a window, intially maximized, with a multiline edit and a list control. The list control, which is over to the right, should be 200 px wide and the full height of the window. The edit control should take up the rest of the area of the window (i.e. width -200px, full height). Bit like the help window in Scite, but with the panes reversed.

Ideally I'd like just the border between the two controls to be draggable, so that if you increase the list width the edit control shrinks, and vice versa.

Also, if the window is resized I'd like the height of the list to adjust while the width remains constant, with the edit control resizing both horizontally and vertically to occupy the remaining window space. Again, very much like the Scite help window does.

Nearest I've got so far is:

#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>
#include <ProgressConstants.au3>
#include <ListboxConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <GuiConstantsEx.au3>
#include <EditConstants.au3>
#include <GuiEdit.au3>
#include <String.au3>
#include <Array.au3>
#include <File.au3>
#include <Misc.au3>

; ===============================================
; set mode
; ===============================================

Opt("GUIOnEventMode",1)

; ===============================================
; declare variables
;===============================================

Dim $winsize[2]

Global $hWindow,$hEdit,$hList
Global $winw,$winh

; ===============================================
; create main window
;===============================================

$hWindow=GUICreate("",750,460,-1,-1,BitOr($WS_OVERLAPPEDWINDOW,$WS_MAXIMIZE))
GUISetOnEvent($GUI_EVENT_CLOSE,"CloseWindow",$hWindow)

; ===============================================
; show main window
; ===============================================

GUISwitch($hWindow)
GUISetState(@SW_SHOW,$hWindow)

; ===============================================
; create main window controls
; ===============================================

$winsize=WinGetClientSize($hWindow)
$winw=$winsize[0]
$winh=$winsize[1]

$hEdit=GUICtrlCreateEdit("",0,0,$winw-200,$winh,BitOR($WS_SIZEBOX,$ES_MULTILINE,$WS_VSCROLL,$ES_WANTRETURN))
GUICtrlSetState($hEdit,$GUI_ENABLE)
GUICtrlSetState($hEdit,$GUI_FOCUS)

$hList=GUICtrlCreateList("",$winw-200,0,200,$winh,BitOR($WS_SIZEBOX,$WS_VSCROLL))
GUICtrlSetState($hList,$GUI_ENABLE)

; ===============================================
; close function
; ===============================================

Func CloseWindow()  
  Exit
EndFunc

; ===============================================
; main loop
; ===============================================

While 1
  Sleep(100)
WEnd

; -----------------------------------------------

Any help gratefully received!

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