Jump to content

Recommended Posts

Posted

I'm using the sample provided in the help file for creating my own browser. I want to record coordinates the user clicks later on, but I'm experimenting with the GUICoordMode so that I can better understand how it works. When I set the mode to 1, everything works fine, but when I set the mode to 0 all the buttons except for 1 disappears.

Any help would be appreciated. I'm trying my best to learn from the help file, but I'm stuck on this one.

Posted

Well, I wanted it to use the coordinates in the window and not from the screen, so that the gui could be moved around.

I just don't understand why that would break displaying the buttons from the browser demo. Strange, but I'm sure someone understands it.

  • Moderators
Posted (edited)

followgeo,

All the GUICoordMode does is to alter how you define the position of your controls. :mellow:

If you leave it at 1 (the default) you define the controls relative to the GUI in which you creating the controls:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

; Relative to GUI
GUICtrlCreateButton("one", 10, 10, 80, 30)
GUICtrlCreateButton("two", 10, 50, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

If you change it to 0, the control is positioned relative to the previous control:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

; Relative to GUI
GUICtrlCreateButton("one", 10, 10, 80, 30)
Opt("GUICoordMode", 0)
GUICtrlCreateButton("two", 0, 40, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

See the difference? In the first example, the coords are:

10, 10
10, 50

In the second:

10, 10 ; Stil the same because you need one control to anchor the others!
0, 40  ; same x coord (10) - add 40 to y coord (50)

Try changing the positon of the "one" button in each case. In the first examplw, "two" stays where it was - in the second it follows "one".

Does that help? If not, do as JohnOne has suggested and post the code which is giving you problems. :P

M23

Edit: Typnig!

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Posted

Ok, maybe I'm understanding the purpose of the GuiCoordMode. I thought that would tell it how to calculate coordinates. I would like the coordinates for mouse clicks to be calculated based on the gui and not on the entire screen. I hope I have my terminology correct (still learning).

  • Moderators
Posted (edited)

followgeo,

You need MouseCoordMode for that!

M23

Edit: See you already know! :mellow:

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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
×
×
  • Create New...