Sign in to follow this  
Followers 0
jaberwacky

Assigning to a map [Solved]

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

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

Share this post


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
Sign in to follow this  
Followers 0