Jump to content

GUICtrlCreateGroup() question.


Recommended Posts

Why would the following three groups all have different "top" and "height" coordinates?

$GUI_Main = GuiCreate("", 480, 280)
GUISetState(@SW_SHOW, $GUI_Main)

$len = 360
Display_Group()
Sleep(1000)
GUISetFont(14)
$len = 320
Display_Group()
Sleep(1000)
GUISetFont(6)
$len = 280
Display_Group()

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then   ExitLoop
Wend
Exit

;-------------------------------------------------------------------------------
Func Display_Group()
    GUICtrlCreateGroup("", 20, 80, $len, 90)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
EndFunc

Is it normal behavior for the current font size to affect both the location and size of group controls?

Edit: Answering my own question: I didn't think so...

Edited by Spiff59
Link to comment
Share on other sites

I hadn't noticed this before, but it does sort of make sense. If you put some text in the first param of that GUICtrlCreateGroup you'll see that it always tries to match up that top edge with the middle of the text. So when the text changes size, so does the position of the top edge. I can see what MS had in mind when they set that up, but I can also see where that can make things confusing.

Link to comment
Share on other sites

First it looks very funny and strange, but as I played a little with your code I found out that the second frame always was out of place. So I added a text and found that the font of the caption was different. So I added in the Display_Group the GUICtrlSetFont(-1,10).

Now the groups are in the same possition. Does this help you?

(to see the difference just remark my line GUICtrlSetFont(-1,10)....

#include <WindowsConstants.au3>
$GUI_Main = GuiCreate("", 480, 280)
GUISetState(@SW_SHOW, $GUI_Main)

$len = 50
Display_Group(1)
Sleep(1000)
GUISetFont(14)
$len = 100
Display_Group(2)
Sleep(1000)
GUISetFont(6)
$len = 150
Display_Group(3)

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then   ExitLoop
Wend
Exit

;-------------------------------------------------------------------------------
Func Display_Group($i)
    GUICtrlCreateGroup($i, 20, 10, $len, 100,-1,-1)
    GUICtrlSetFont(-1,10)
;~     GUICtrlCreateGroup("", -99, -99, 1, 1)
EndFunc
Link to comment
Share on other sites

So I added a text and found that the font of the caption was different. So I added in the Display_Group the GUICtrlSetFont(-1,10).

I think that was his point actually. He was wondering why the font size was affecting the group's appearance, hence his comment:

Is it normal behavior for the current font size to affect both the location and size of group controls?

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