[Gambas-user] Warning: Class name hidden by local declaration: key
Demosthenes Koptsis
demosthenesk at gmail.com
Tue Aug 1 13:46:35 CEST 2023
ah it is a reserved word you mean...ok!
thanks!
On 8/1/23 14:39, BB wrote:
> On 1/8/23 8:54 pm, Demosthenes Koptsis wrote:
>> i wrote a demo code for Action property as follows...
>>
>> i have a Form with a Menu and a Button for "save" Action
>>
>> ------------------------------------------------------------
>>
>> ' Gambas class file
>>
>> Public Sub Form_Open()
>> Me.Center
>> Menu1.Action = "save"
>> Button1.Action = "save"
>> End
>>
>> Public Sub Action_Activate(key As String) As Boolean
>> Select Case key
>> Case "save"
>> ' call save sub at here
>> Print "save to a file."
>> End Select
>> End
>>
>> ------------------------------------------------------------
>>
>> i get a warning at line 9, Public Sub Action_Activate(key As String)
>> As Boolean
>>
>> Class name hidden by local declaration: key
>>
>>
>> What does this mean ?
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
> It means that you have used a, well let's say a, "significant" word as
> a variable name (in this case a variable described as a parameter name).
>
> What does that mean?
>
> It means that within the scope of your declaration of that variable
> you cannot expect to use the native Key class to be operative. So
> Gambas is telling you essentially that "OK, you want to use one of my
> special names as your own variable name and instead of it referring to
> my Key class, then fine I'll just use your string variable. Fine, OK
> then I guess you know what you're doing."
>
> In other words, as long as you don't refer to the native class within
> the scope of that procedure then everything will work as you expect.
>
> b
>
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
More information about the User
mailing list