Sign in to follow this  
Followers 0
KSum

Get the coordinates of a Checkbox

5 posts in this topic

I have a GUI that has several checkboxes created.  I show and hide groups of these based on a radio button.  That all works fine.  I would like to resize the window based on the checkboxes shown.  I know which one will be the farthest extent and can resize based on this if I know the coordinates used to create the checkbox.  Is there any way to read these as opposed to saving a variable for each set?

Karl

Share this post


Link to post
Share on other sites



KSum,

If you have stored the ControlID of the checkbox, you can use ControlGetPos to find its location. :)

M23

P.S. Have you looked at my GUIExtender UDF (the link is in my sig)? It might save you a lot of coding. ;)


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

As I understand it, I should be able to use WinMove and redefine the size. With that in mind, I shouldn't need a lot of coding.  Then again, when I use this to widen the GUI, my checkboxes seem to move over the same amount as the added width.  And I have tried all 3 settings for AutoItSetOption("GUICoordMode", _) as well as not defining this option at all.

I am widening the GUI I create to show checkboxes arranged in columns.  I have an array of checkboxes, and have the low and high array item for a set, so I have $checkbox[$I] as the last item in the set.  Does ControlGetPos work on the running AutoIt window?  I was expected for a GUI_____ but have been wrong before...

Share this post


Link to post
Share on other sites

KSum,

I suggest you post the code you are using - then we can see what might be the problem with your checkboxes. :)

And the Control* commands work perfectly well on AutoIt GUIs - after all they are just GUIs. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I have the checkboxes not moving now.  Had to add this after the creation of each:

GUICtrlSetResizing(-1, BitOr($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKSIZE)); <- Set the resizing for the control

And the ControlGetPos works well too.  I decided, however to just divide the total number of checkboxes displayed by the number of boxes in each column and then multiply that by the width per column:

;$I1 is passed as the number of checkboxes
;calculate the number of columns, Rounding the result up to the nearest integer
$MainGUIWidth = 560 + (((Ceiling($I1/6)) - 2) * 125)

WinMove($MainGUIName, "", Default, Default, $MainGUIWidth, Default)

Share this post


Link to post
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
Sign in to follow this  
Followers 0