Jump to content

$WS_SIZEBOX question


Recommended Posts

Hi,

I have a window with an edit control and a list control. I'd like to be able to resize the list control horizontally, with the width of the edit control adjusting automatically.

I tried using $WS_SIZEBOX, which sort of works. Three questions:

1. Is it possible to link the controls so that they resize together?

2. If not, is it possible to disable three of the borders so only the left list border and the right edit border can be dragged?

3. Is it possible to arrange things so that it's not possible to increase the size of either control so that it overlaps the other?

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

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

Opt("GUIOnEventMode",1)

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

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

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

$hEdit=GUICtrlCreateEdit("",0,0,610,460,BitOR($WS_SIZEBOX,$ES_MULTILINE,$WS_VSCROLL,$ES_WANTRETURN,$ES_NOHIDESEL))
GUICtrlSetResizing($hEdit,$GUI_DOCKAUTO)
GUICtrlSetState($hEdit,$GUI_ENABLE)
GUICtrlSetState($hEdit,$GUI_FOCUS)

$hList=GUICtrlCreateList("",610,0,140,460,BitOR($WS_SIZEBOX,$WS_VSCROLL))
GUICtrlSetResizing($hList,$GUI_DOCKAUTO)
GUICtrlSetState($hList,$GUI_ENABLE)

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

GUISwitch($hWindow)
WinSetState($hWindow,"",@SW_MAXIMIZE)
GUISetState(@SW_SHOW,$hWindow)

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

Func CloseWindow()
  Exit
EndFunc

; ===============================================
; idle loop
; ===============================================

While 1
  Sleep(100)
WEnd

Thanks!

Link to comment
Share on other sites

Hi Zedna, thanks for the response. I've tried playing around with GUICtrlSetResizing() but none of the options seem to do exactly I want. I need the two controls to be the always the full height of the window, with the option of increasing the width of one while decreasing the width of the other.

Can you tell me what I should be using?

Link to comment
Share on other sites

I need the two controls to be the always the full height of the window

Can be done by GUICtrlSetResizing()

with the option of increasing the width of one while decreasing the width of the other.

Can't be done by GUICtrlSetResizing() you need to use some helper control which can be dragged by user and your listbox may be positioned relatively by GUICtrlSetResizing() to this helper control.

I have seen some topics on the forum for that, try to search.

Edited by Zedna
Link to comment
Share on other sites

I was thinking - is it possible to get the height and width of a control, and also detect if it has been resized? Then the other control could be sized accordingly.

Yes you can catch WM_SIZE by GUIRegisterMsg() and do what you want there.

This way it will probably flicker.

Edited by Zedna
Link to comment
Share on other sites

Can GUIRegisterMsg() be linked to a control within a window? I tried using GUIRegisterMsg($WM_SIZE,"Some_Function)but it only worked when the window was resized, not the edit control.

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