Jump to content

Gui resizing problem


Recommended Posts

I made a dialog, and it looks quite nice, but I have some problems when I try to resize it.

CODE

;coda wrote this code:

$Channel = GUICreate("wnd1", 603, 268, 219, 196, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS))

$nicklist = GUICtrlCreateList("", 0, 0, 111, 240, BitOR($LBS_SORT,$LBS_STANDARD,$WS_HSCROLL,$WS_VSCROLL,$WS_BORDER))

$chinputbox = GUICtrlCreateInput("", 0, 245, 541, 21)

$chatrcv = GUICtrlCreateEdit("", 111, 0, 490, 246, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL))

$chsendbtn = GUICtrlCreateButton("send", 542, 242, 60, 25, $BS_DEFPUSHBUTTON, $WS_EX_CLIENTEDGE)

;i added this junk:

GUICtrlSetResizing($chanrcv,$GUI_DOCKhcenter+$gui_dockvcenter)

GUICtrlSetResizing($chinputbox,$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKhCENTER)

GUICtrlSetResizing($chsendbtn,$GUI_DOCKBOTTOM+$GUI_DOCKSIZE)

GUISetState(@SW_SHOW)

Try to vertically resize the window and you'll see the edit and the input separated by empty space coming from nowhere. Additionally the edit and the list will become of different height, and they shouldn't. Bad listbox. :whistle:

Now try to horizontally resize the window, and the input and send button will get one over the other.

How can I prevent those things from happening?

Do I have to manually resize each control everytime the dialog is resized? How can I do this? And how can I do this without making the cpu usage grow up to 120%?

Link to comment
Share on other sites

The reason for the listbox resizing is that by default, the height of a listbox is locked to a multiple of the height of a single item. You need to add the $LBS_NOINTEGRALHEIGHT style to make it behave otherwise.

As for your resizing, try this:

GUICtrlSetResizing($chatrcv,$GUI_DOCKBORDERS)
GUICtrlSetResizing($nicklist,$GUI_DOCKWIDTH+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlSetResizing($chinputbox,$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT+$GUI_DOCKLEFT+$GUI_DOCKRIGHT)
GUICtrlSetResizing($chsendbtn,$GUI_DOCKSIZE+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)

While testing this, I ran into something strange: The controls seem to resize in discrete steps, a few pixels at a time, instead of continuously. Maybe a bug, maybe not. Anyone observed this before?

Edited by Sokko
Link to comment
Share on other sites

Uhm... I have another problem now... How can I make the listbox react on right click and doubleclick instead than on a single left click?

Edit: And I don't understand if I can edit only one line of the listbox without having to edit the others. Maybe I need to use a listview for this?

Edited by LuigiMario
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...