Spiff59 Posted May 4, 2010 Share Posted May 4, 2010 (edited) 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 May 5, 2010 by Spiff59 Link to comment Share on other sites More sharing options...
therks Posted May 6, 2010 Share Posted May 6, 2010 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. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Tankbuster Posted May 6, 2010 Share Posted May 6, 2010 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 More sharing options...
therks Posted May 6, 2010 Share Posted May 6, 2010 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? My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Tankbuster Posted May 6, 2010 Share Posted May 6, 2010 @therks Sorry, my fault. It looks like he was searching for a solution. Link to comment Share on other sites More sharing options...
therks Posted May 7, 2010 Share Posted May 7, 2010 Yeah and to me it doesn't look like there is one, short of doing something like you did. I think that would just be the best option. Wrap GUICtrlCreateGroup in a function like yours and go to town. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now