ChrisS85 / CGUI

An object-oriented GUI library for AutoHotkey
22 stars 19 forks source link

various optimizations for the __set workaround #33

Closed infogulch closed 12 years ago

infogulch commented 12 years ago

There be dragons...

Apparently this._.GUINum is empty. this.GUINum is empty as well (I checked)

Error in #include file "Lib\CListViewControl.ahk":
     Invalid Gui name.

Specifically: :Default

        Line#
        319: Return,LV_GetCount()
        320: }
        332: {
        334: GUI := CGUI.GUIList[this._.GUINum]
        335: if (GUI.IsDestroyed)  
        336: Return
        337: Control := GUI.Controls[this._.hwnd]
--->    338: Gui,this._.GUINum ":Default"
        339: Gui,ListView,Control.hwnd
        340: SortedIndex := LV_Add(Options, Fields*)
        341: UnsortedIndex := (UnsortedIndex := this._.MaxIndex() + 1) ? UnsortedIndex : 1
        342: Row := new this.CRow(SortedIndex, UnsortedIndex, this._.GUINum, this._.hwnd)
        343: this._.Insert(UnsortedIndex, Row)  
        344: if (InStr(Options, "Select"))  
        345: {

The current thread will exit.
infogulch commented 12 years ago

Found it: commit 9b74ab

The problem must be that a __set routine somewhere doesn't return the set value and it should:

Set: If the operation was successful, __Set should return the new value of the field, which may differ from the original r-value. This allows assignments to be chained, as in a.x := b.y := z. An empty string should be returned if the assignment failed, allowing the script to detect the error.

http://www.autohotkey.net/~Lexikos/AutoHotkey_L/docs/Objects.htm#Meta_Functions

Edit: I had a look around and I didn't see any set function that was handled incorrectly.

I tried to convert them to something more specific like return Value, return (this[Params*])[Name] := Value or

(this[Params*])[Name] := Value
return Value

but neither worked. So there must be something wrong with commit 9b74ab

ChrisS85 commented 12 years ago

Maybe it needs to be done in two lines afterall.