Modify ↓
Opened 13 years ago
Closed 13 years ago
#1940 closed Feature Request (Rejected)
GUI*OnEvent default functions
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | Severity: | None | |
Keywords: | guisetonevent guictrlsetonevent gui event onevent default | Cc: |
Description
Could we get a function that lets us set a default function for any controls/events to call that aren't specifically applied.
It would just make code a lot cleaner I think, because then you could change code like this:
$hGUI = GUICreate('Ex', 300, 300) GUISetOnEvent($GUI_EVENT_CLOSE, '_WinFunction') GUISetOnEvent($GUI_EVENT_RESIZED, '_WinFunction') GUISetOnEvent($GUI_EVENT_DROPPED, '_WinFunction') GUISetOnEvent($GUI_EVENT_MINIMIZE, '_WinFunction') $hMenu = GUICtrlCreateMenu('Menu') $hItem1 = GUICtrlCreateMenuItem('Item 1', $hMenu) GUICtrlSetOnEvent(-1, '_MenuFunction') $hItem2 = GUICtrlCreateMenuItem('Item 2', $hMenu) GUICtrlSetOnEvent(-1, '_MenuFunction') $hItem3 = GUICtrlCreateMenuItem('Item 3', $hMenu) GUICtrlSetOnEvent(-1, '_MenuFunction')
To this:
$hGUI = GUICreate('Ex', 300, 300) GUISetOnEventDefault('_WinFunction') GUICtrlSetDefaultEvent('_MenuFunction') ; Set default function $hMenu = GUICtrlCreateMenu('Menu') $hItem1 = GUICtrlCreateMenuItem('Item 1', $hMenu) $hItem2 = GUICtrlCreateMenuItem('Item 2', $hMenu) $hItem3 = GUICtrlCreateMenuItem('Item 3', $hMenu) GUICtrlSetDefaultEvent() ; Clear default function
With an optional second parameter of GUI window handle.
Attachments (0)
Change History (1)
comment:1 Changed 13 years ago by Valik
- Resolution set to Rejected
- Status changed from new to closed
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Note: See
TracTickets for help on using
tickets.
Trivial to write your own wrapper function to do this.