Proposed New GUI API for AutoHotkey v2
Re: Proposed New GUI API for AutoHotkey v2
Flipeador, scroll up to "Do you intend to implement CtrlObj.Destroy()?" (on page 12, same as your post)
Re: Proposed New GUI API for AutoHotkey v2
Ooh! i remember now. I think I've read it before. I'm too forgetful.
Thanks.
Thanks.
Re: Proposed New GUI API for AutoHotkey v2
Some thoughts:
- is there an option: GUI specify class name/hIcon/WNDCLASSEX
- ... and/or: GUI take control of a GUI window created by same script via DllCall?
- date control: SetFormat, Choose (but what about GetFormat, GetValue (number), GetText (appearance)?) (although for example, you could have read/write Format property, read/write Value property, read-only Text property) [EDIT: these is some '.Value' functionality]
- also, why 'Ctrl' rather than 'Ctl', isn't 'Ctl' far more common, and less prone to confusion with the Ctrl key?
Btw for anyone interested in testing there is some documentation available now:
GuiCreate
https://lexikos.github.io/v2/docs/comma ... Create.htm
GuiCtrlFromHwnd
https://lexikos.github.io/v2/docs/comma ... omHwnd.htm
GuiFromHwnd
https://lexikos.github.io/v2/docs/comma ... omHwnd.htm
GUI Control Types
https://lexikos.github.io/v2/docs/comma ... ntrols.htm
ListView (GUI)
https://lexikos.github.io/v2/docs/commands/ListView.htm
TreeView (GUI)
https://lexikos.github.io/v2/docs/commands/TreeView.htm
GUI Object
https://lexikos.github.io/v2/docs/objects/Gui.htm
OnEvent
https://lexikos.github.io/v2/docs/objec ... nEvent.htm
OnNotify
https://lexikos.github.io/v2/docs/objec ... Notify.htm
OnCommand
https://lexikos.github.io/v2/docs/objec ... ommand.htm
OnMessage
https://lexikos.github.io/v2/docs/comma ... essage.htm
- is there an option: GUI specify class name/hIcon/WNDCLASSEX
- ... and/or: GUI take control of a GUI window created by same script via DllCall?
- date control: SetFormat, Choose (but what about GetFormat, GetValue (number), GetText (appearance)?) (although for example, you could have read/write Format property, read/write Value property, read-only Text property) [EDIT: these is some '.Value' functionality]
- also, why 'Ctrl' rather than 'Ctl', isn't 'Ctl' far more common, and less prone to confusion with the Ctrl key?
Btw for anyone interested in testing there is some documentation available now:
GuiCreate
https://lexikos.github.io/v2/docs/comma ... Create.htm
GuiCtrlFromHwnd
https://lexikos.github.io/v2/docs/comma ... omHwnd.htm
GuiFromHwnd
https://lexikos.github.io/v2/docs/comma ... omHwnd.htm
GUI Control Types
https://lexikos.github.io/v2/docs/comma ... ntrols.htm
ListView (GUI)
https://lexikos.github.io/v2/docs/commands/ListView.htm
TreeView (GUI)
https://lexikos.github.io/v2/docs/commands/TreeView.htm
GUI Object
https://lexikos.github.io/v2/docs/objects/Gui.htm
OnEvent
https://lexikos.github.io/v2/docs/objec ... nEvent.htm
OnNotify
https://lexikos.github.io/v2/docs/objec ... Notify.htm
OnCommand
https://lexikos.github.io/v2/docs/objec ... ommand.htm
OnMessage
https://lexikos.github.io/v2/docs/comma ... essage.htm
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Proposed New GUI API for AutoHotkey v2
Are there any reasons why GuiCtrlObj := Gui.Control[Name] is not a method?
Compared to the other properties, its behaviour is awkward and not necessarily predictable. For example:
In my opinion, it's almost predestined to be a method.
Maybe it could be somehow merged with Gui._NewEnum, in which case it could return an array of GuiControl objects, if Gui.Control's parameter is omitted.
Compared to the other properties, its behaviour is awkward and not necessarily predictable. For example:
Code: Select all
Gui := GuiCreate()
Gui.Add("Edit", "vName")
Gui.Show()
; When assuming an array of controls would be returned without property:
MsgBox(Gui.Control) ; -> Invalid usage error
; When assuming the default property syntax works here too:
MsgBox(Gui.Control.Name) ; -> Invalid usage error
Maybe it could be somehow merged with Gui._NewEnum, in which case it could return an array of GuiControl objects, if Gui.Control's parameter is omitted.
Re: Proposed New GUI API for AutoHotkey v2
It's a collection of objects belonging to the GUI. That's a property in the general sense. You can't retrieve the collection itself now, but maybe in the future. (It is low priority due to the fact that adding it later won't break anything.)Ragnar wrote:Are there any reasons why GuiCtrlObj := Gui.Control[Name] is not a method?
Properties a script defines with parameters (for the getter/setter) are no different. RegExMatch also has a few properties like this, but allows () as well due to ambiguity (with named patterns). COM objects also have properties with parameters, but again, () can be used due to the way IDispatch works.
The behaviour is predictable. Use the syntax shown in the documentation, and it will work. Use other syntax, and it won't.
Re: Proposed New GUI API for AutoHotkey v2
For Gui.OnEvent and/or GuiCtrl.OnEvent, what about chaining events which have the same Callback parameter (like jQuery's .On()). For Example:
would be then:
Code: Select all
Gui.OnEvent("Close", "Gui_Close")
Gui.OnEvent("Escape", "Gui_Close")
Code: Select all
Gui.OnEvent("Close Escape", "Gui_Close")
Re: Proposed New GUI API for AutoHotkey v2
The deactivation of notification handlers dosn't seem to work, or is there something wrong with this:
I also tried to pass 0 directly.
Also, the Type() of GuiControl objects still contains "struct ".
Code: Select all
; ===================================================================================================================
; ShowColors() Sets ListView coloring on/off.
; Parameters: Show - True/False
; Default: True
; Return Value: True on success, otherwise false.
; ===================================================================================================================
ShowColors(Show := True) {
If !(This.HLV)
Return False
This.Ctl.OnNotify(0xFFFFFFF4, This.DrawFunc, !!Show) ; NM_CUSTOMDRAW = -12
WinRedraw("ahk_id " . This.HLV)
Return True
}
Also, the Type() of GuiControl objects still contains "struct ".
Re: Proposed New GUI API for AutoHotkey v2
(I seem to have missed your post.) I'd thought of that, but was getting tired of thinking about the GUI code. I was focused on making the API consistent, and was less concerned about convenience. There's room to add this and other "for convenience" features at any point in the future.Ragnar wrote:Gui.OnEvent("Close Escape", "Gui_Close")
A more general idea was to allow chaining of methods; i.e. wherever a gui/control method has no other return value, return the gui/control object. However, that one has wider implications and probably requires careful consideration for each method. There might also be a more universal solution (which wouldn't require memorising which methods support chaining) - e.g. something like VB's with, which would work regardless of the method's return value, and with properties.
There was a bug. This one should work: AutoHotkey_2.0-a078-107+gaea90d6.zipjust me wrote:The deactivation of notification handlers dosn't seem to work
Yes, I'm well aware. It's a consequence of deriving the class names from the C++ type names, and fixing type() to just remove "struct " would be redundant at this point. It needs to be changed to allow each class to define its own type name. See Type(object).Also, the Type() of GuiControl objects still contains "struct ".
Re: Proposed New GUI API for AutoHotkey v2
Yes, it seems to work now. Thanks!lexikos wrote:There was a bug. This one should work: AutoHotkey_2.0-a078-107+gaea90d6.zip
Sorry, I didn't remember this.lexikos wrote:See Type(object).
Re: Proposed New GUI API for AutoHotkey v2
Can't offer any grunt to this thread, but just the usual useless words of encouragement. Keep rowing boys!
itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
Return to “AutoHotkey Development”
Who is online
Users browsing this forum: No registered users and 23 guests