Jump to content

Assigning to a map [Solved]


Recommended Posts

Hello.  I'm trying to assign to a map, but I get the following error message:

"..." (51) : ==> Subscript used on non-accessible variable.:
$mSelected[$mCtrl.Hwnd] = $mCtrl
$mSelected^ ERROR

Here is a reproducer:

Global $mCtrl[]

$mCtrl.HWnd = GUICtrlCreateButton("ButtButt", 10, 10)

Global $mSelected[]

$mSelected[$mCtrl.HWnd] = $mCtrl

Actually, my reproducer gives a different error:

"...\Test.au3" (1) : ==> Variable subscript badly formatted.:
Global $mCtrl[]
Global $mCtrl[^ ERROR

I can't find my error.  Do you see it?

Edited by jaberwacky
Link to comment
Share on other sites

Here is my exact function from the main script:

Func _add_to_selected(Const $mCtrl)
    Switch MapExists($mSelected, $mCtrl.Hwnd)
        Case False
            $selected_count += 1
            
            $mSelected[$mCtrl.Hwnd] = $mCtrl            
            
            ConsoleWrite($selected_count & @TAB & $mCtrl.Hwnd & @CRLF)
            
            Return True
    EndSwitch

    Return False
EndFunc

HHHHHHHHRRRRRRRRRRNNNNNNNNNNNNNNNGGGGGGGGGGGGGGGGG!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

There is no reason this shouldn't work!

Edited by jaberwacky
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...