Jump to content

how can gui background set icon "hand" and how can gui background click action gui close? - (Moved)


Recommended Posts

  • Moderators

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

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

 

Link to post
Share on other sites
  • Moderators

drmusti,

Please stick to just the one thread - merged.

M23

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

 

Link to post
Share on other sites
  • Moderators

drmusti,

No problem.

As to your questions:

  • Look at GUISetCursor.
  • Not sure what you mean - do you want the GUI to close whenever a click is made within it?

M23

 

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

 

Link to post
Share on other sites
16 hours ago, Melba23 said:

drmusti,

No problem.

As to your questions:

  • Look at GUISetCursor.
  • Not sure what you mean - do you want the GUI to close whenever a click is made within it?

M23

 

 

#include <GUIConstantsEx.au3>



Global $g_iIDC = -1, $g_iNewIDC = 0


Example()

Func Example()
   

    Local $hMainGUI =GUICreate("Press ESC to Increment", 300, 100, 300, 500)
GUICtrlSetOnEvent($hMainGUI, "CLOSEButton")
    GUISetState(@SW_SHOW)

    While GUIGetMsg() <> $GUI_EVENT_CLOSE
        If $g_iNewIDC <> $g_iIDC Then
            $g_iIDC = $g_iNewIDC
            GUISetCursor("Hand")
            
        EndIf
        ;;ToolTip("GUI Cursor #" & $g_iIDC & " (" & $g_aArray[$g_iIDC] & ")")
        
        
        
    WEnd

    GUIDelete()
EndFunc   ;==>Example





Func CLOSEButton()
    ; Note: At this point @GUI_CtrlId would equal $GUI_EVENT_CLOSE,
    ; and @GUI_WinHandle would equal $hMainGUI
    MsgBox($MB_OK, "GUI Event", "You selected CLOSE! Exiting...")
    Exit
EndFunc

GUICtrlSetOnEvent($hMainGUI, "CLOSEButton") dont action.

 

Link to post
Share on other sites
Link to post
Share on other sites
  • Moderators

drmusti,

In the original script you posted you were not setting OnEvent mode, but trying (with incorrect syntax) to set an event for the GUI [X] button. You CANNOT mix OnEvent and MessageLoop modes in the same script (unless you are very careful and know exactly what you are doing). Here is your basic script rewritten with copious comments:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Opt("GUIOnEventMode", 1) ; Set OnEvent mode

Example()

; This is the main idle loop - in OnEvent mode you should ALWAYS return here ASAP
While 1 ; You cannot use GUIGetMsg here because you are in OnEvent mode
    Sleep(10) ; You need this to prevent the CPU from overheating - in MessageLoop mode, GUIGetMsg does this for you automatically
WEnd

Func Example()
    Local $hMainGUI = GUICreate("Press ESC to Increment", 300, 100, 300, 500)
    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton")
    GUISetState(@SW_SHOW)
    ; Return to the main idle loop - do not wait in the function
EndFunc   ;==>Example

Func CLOSEButton()
    MsgBox($MB_OK, "GUI Event", "You selected CLOSE! Exiting...")
    Exit
EndFunc   ;==>CLOSEButton

Now the [X] button works. Please ask if you have any more questions.

M23

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

 

Link to post
Share on other sites
  • Moderators

drmusti,

When you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders know what they wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation.

Quote

click over gui . no close icon

I asked you that question earlier in the thread but you never gave a coherent reply.

If you want to close the GUI by clicking within the GUI itself then I suggest a using label to fill the GUI and then setting an event to the label to run the CLOSEButton function - like this:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Opt("GUIOnEventMode", 1)

Example()

While 1 ; GUIGetMsg() <> $GUI_EVENT_CLOSE
    Sleep(10)
WEnd

Func Example()
    Local $hMainGUI = GUICreate("Press ESC to Increment", 300, 100, 300, 500)
    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton")
    $cLabel = GUICtrlCreateLabel("", 0, 0, 300, 500)
    GUICtrlSetOnEvent($cLabel, "CLOSEButton")
    GUISetState(@SW_SHOW)
EndFunc   ;==>Example

Func CLOSEButton()
    MsgBox($MB_OK, "GUI Event", "You selected CLOSE! Exiting...")
    Exit
EndFunc   ;==>CLOSEButton

However, that means you cannot have any other controls in the GUI. You decide if that is what you really want.

M23

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

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...