Form X. is redefined incorrect in Class FMain

New to Gambas? Post your questions here. No question is too silly or too simple.
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Form X. is redefined incorrect in Class FMain

Post by BruceSteers »

It's best to avoid any declaration names that objects have already.

Internal vars can have a $ prefix so $X will be no problem.

I think the error is that the FMain.class file Inherits Form and all form properties.
So X is already defined in the FMain.class. same applies to all variable names Form has.

Hope that makes sense.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Form X. is redefined incorrect in Class FMain

Post by BruceSteers »

fox73 wrote: Tuesday 9th February 2021 1:45am Hello out there,

On debugging my source code, I've got the error message "Form X. wird in der Klasse FMain inkorrekt redefiniert"
(which should be translated into English something like "Form X. is redefined incorrect in Class FMain".

I understand this message now.
Sorry I did not before.
In English it would say
Form.x in incorrectly overridden.

Because using x tried to override the Form.x property (that your FMain.class inherits)
If at first you don't succeed , try doing something differently.
BruceS
User avatar
fox73
Posts: 7
Joined: Tuesday 9th February 2021 1:27am

Re: Form X. is redefined incorrect in Class FMain

Post by fox73 »

stevedee wrote: Saturday 13th February 2021 6:31pm
fox73 wrote: Saturday 13th February 2021 4:55pm ...omitting the declaration of "x" resolves the problem. So I assume that "x" is a
reserved word in GamBas - is that right?
The error says "Form.X" which would be the X property of a form called Form...which doesn't make sense.

Maybe just copy and paste the section of code that mentions Form.X.
I'd like to do, but I can't, as there is NO Form.X in my source code! Here is, where Form- or Me. are mentioned:
Public Sub Form_Open()
   Me.Show   
End
...
Public Sub btnEnde_Click()
   Me.Close   
End
Playing around I typed "Form." and then scrolled through the properties, if there would be an "X" - and got this message:
Xproperty.png
Xproperty.png (39.56 KiB) Viewed 2888 times
This makes it quite clear to me, why I cannot use a variable "X" - same for "Y" which is for the top border.

So I would say: "Problem solved - thanks and have a nice Sunday."

Oops - just saw that Bruce already posted the solution. Thanks a lot.
Post Reply