erebus Posted December 11, 2005 Share Posted December 11, 2005 Hello all, I am trying to find a workaround on a label's alignment but with no luck. Let's say we have a single line GUICtrlCreateLabel($status) and we want to locate it in the middle of our GUI's width (or even height). If we know the $status length we can do this by hand; however if we don't use a fixed width font when we update $status there is no way to know the exact label's width (in pixels and NOT in characters) so as to locate it appropriately in the GUI. Any suggestions? Link to comment Share on other sites More sharing options...
BigDod Posted December 11, 2005 Share Posted December 11, 2005 Hello all, I am trying to find a workaround on a label's alignment but with no luck. Let's say we have a single line GUICtrlCreateLabel($status) and we want to locate it in the middle of our GUI's width (or even height). If we know the $status length we can do this by hand; however if we don't use a fixed width font when we update $status there is no way to know the exact label's width (in pixels and NOT in characters) so as to locate it appropriately in the GUI. Any suggestions?I do not know if this is what you require. #include <GUIConstants.au3> ;Generated with Form Designer preview $Text = InputBox("Input", "What do you wish to type") $Form1 = GUICreate("AForm1", 386, 142, 192, 113) $Label1 = GUICtrlCreateLabel( $Text, 0, 0, 382, 137, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect WEnd Exit Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
erebus Posted December 11, 2005 Author Share Posted December 11, 2005 Exactly, thank you very much. However (and while I am not familiar with the use of BitOR) can you please give me another example? Let's say that I have a GUI of 500 pixels width and 400 height and I want to put my label at 100 pixels height and center it between 200 and 300 pixels width only. Since I don't exactly understand the use of BitOR I have no idea of how to alter that line of your code. :/ Thank you very much. Link to comment Share on other sites More sharing options...
BigDod Posted December 11, 2005 Share Posted December 11, 2005 Exactly, thank you very much.However (and while I am not familiar with the use of BitOR) can you please give me another example?Let's say that I have a GUI of 500 pixels width and 400 height and I want to put my label at 100 pixels height and center it between 200 and 300 pixels width only.Since I don't exactly understand the use of BitOR I have no idea of how to alter that line of your code. :/Thank you very much.To be honest with you I do not understand BitOR either I just played around with KODA. It is a brilliant tool that you can download http://www.autoitscript.com/fileman/users/lookfar/index.html Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
erebus Posted December 11, 2005 Author Share Posted December 11, 2005 Thank you very much again, at least you gave me a good point to start search Good day. Link to comment Share on other sites More sharing options...
seandisanti Posted December 12, 2005 Share Posted December 12, 2005 To be honest with you I do not understand BitOR either I just played around with KODA. It is a brilliant tool that you can download http://www.autoitscript.com/fileman/users/lookfar/index.htmlBitOr is a bitwise OR comparison....example:A = 1000001B = 1000010For each bit, if there is a 1 in that position on the A or in the same position for a B, or both, a 1 is returned, otherwise a zero... so a bitwise or of those two would yield:1000011 or C Link to comment Share on other sites More sharing options...
erebus Posted December 14, 2005 Author Share Posted December 14, 2005 You gave the perfect example, thank you very much, I really understood how it works now. However I haven't yet understood where $SS_CENTER and $SS_CENTERIMAGE depend on (in GUIConstants.au3) and how exactly to use them. Can anybody give us a good example/explanation of how they technically work? Link to comment Share on other sites More sharing options...
seandisanti Posted December 14, 2005 Share Posted December 14, 2005 (edited) You gave the perfect example, thank you very much, I really understood how it works now.However I haven't yet understood where $SS_CENTER and $SS_CENTERIMAGE depend on (in GUIConstants.au3) and how exactly to use them.Can anybody give us a good example/explanation of how they technically work?how they work, is the GUIConstants assigns names to the binary values. when you do a bitor() on those constants, you're actually doing a bitwise or comparison on the values they represent, and that is passed to the operating system... although i think bitand() would be the way to combine the styles... ignore that last line, bitand would obviously not combine the values correctly, it was late and i was tired... the reason it wouldn't is because a bitand would only put 1's in the positions that both have a 1... or to use the same example as earlier...A = 1000001B = 1000010a BitAnd() would return 1000000 or @ which would not be a combination of the two by any means... Edited December 14, 2005 by cameronsdad 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