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
fox73
Posts: 7
Joined: Tuesday 9th February 2021 1:27am

Form X. is redefined incorrect in Class FMain

Post by fox73 »

Hello out there,

I am doing my first steps with Gambas 3.14.3 (German language version) on Linux Mint 20.1.

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".

What's the cause of this error and - even more important ;-) - how can I fix it?

Thanks a lot
User avatar
PJBlack
Posts: 184
Joined: Tuesday 9th June 2020 10:26pm
Location: Florstadt, Hessen, Germany

Re: Form X. is redefined incorrect in Class FMain

Post by PJBlack »

wie wärs mit den source-code? hier ist nämlich niemand hellseher ...

how about the source code? no one here is psychic.

-----

post your project ...

Admin note
This is an English language forum, please include a translation when using a different language. Thanks (Vielen Dank) :D
User avatar
BruceSteers
Posts: 1521
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,

I am doing my first steps with Gambas 3.14.3 (German language version) on Linux Mint 20.1.

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".

What's the cause of this error and - even more important ;-) - how can I fix it?

Thanks a lot
It should be FMain.X or the name of your Form (or Me.X) not Form.X
Form is used in events like Form_Open() Form_Close() etc but to address the form properties use its name or Me from within it's class
Public Sub Form_Open()
  Me.X = 25
  Wait 1
  FMain.X = 50
End
there both Me.X and FMain.X mean the same thing.
Bruce
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Form X. is redefined incorrect in Class FMain

Post by BruceSteers »

You can imagine the IDE does this when it creates a default Form (FMain)...

Public FMain As Form

Public Sub Main()

    FMain = New Form As "Form"

End
So Events will accessed like Form_EventName()
Properties are accessed with FMain.PropertyName

FMain_Open() will not work but Form_Open() will
Form.Width will not exist but FMain.Width will.

Hope that makes sense.
Bruce
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 »

PJBlack wrote: Tuesday 9th February 2021 3:14am wie wärs mit den source-code? hier ist nämlich niemand hellseher ...

how about the source code? no one here is psychic.
Sorry PJBlack. Thought this might would be a typical rookie issue that doesn't need source code to be solved.
And by the way - the entire program has more than 650 lines of code. Should I post 'em all? :o

Anyway - thanks for your reply!
User avatar
fox73
Posts: 7
Joined: Tuesday 9th February 2021 1:27am

Re: Form X. is redefined incorrect in Class FMain

Post by fox73 »

BruceSteers wrote: Tuesday 9th February 2021 4:57am It should be FMain.X or the name of your Form (or Me.X) not Form.X
Hi Bruce and thanks for your replies. In fact, it IS Form.X ! Sorry, but I cannot upload a screenshot to proof.

And - I think I found out the code that causes the error:

I have added the following declaration of a variable

:
Public x as Integer
If set this line to comment, the program runs fine and shows my form -
I remove the comment attribute - and get the error again ...
Is "x" a reserved word in GamBas?
User avatar
BruceSteers
Posts: 1521
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: Saturday 13th February 2021 4:45am
BruceSteers wrote: Tuesday 9th February 2021 4:57am It should be FMain.X or the name of your Form (or Me.X) not Form.X
Hi Bruce and thanks for your replies. In fact, it IS Form.X ! Sorry, but I cannot upload a screenshot to proof.
yes taking screenshots can be exceptionally complicated.
fox73 wrote: Saturday 13th February 2021 4:45am And - I think I found out the code that causes the error:

I have added the following declaration of a variable

:
Public x as Integer
If set this line to comment, the program runs fine and shows my form -
I remove the comment attribute - and get the error again ...
Is "x" a reserved word in GamBas?
you tell me.
here is the help page
http://gambaswiki.org/wiki/
Last edited by BruceSteers on Saturday 13th February 2021 6:43pm, edited 1 time in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Form X. is redefined incorrect in Class FMain

Post by stevedee »

fox73 wrote: Saturday 13th February 2021 3:43am ...And by the way - the entire program has more than 650 lines of code. Should I post 'em all?...
Hi fox73, when you compose a post on the GambasONE forum, there are 2 tabs below; Options and Attachments.


gambasAddFiles.png
gambasAddFiles.png (109.35 KiB) Viewed 6634 times


If you can zip or compress your project, then you can attach it to your post by using Attachments > Add files.

You can also add your screenshots in a similar way, although these should not be compressed.

Please let us know if you are still having problems with this.

I hope this helps.

SteveDee
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 9:37am If you can zip or compress your project, then you can attach it to your post by using Attachments > Add files.

You can also add your screenshots in a similar way, although these should not be compressed.
SteveDee
Oops, sorry. Didn't see those two buttons. So now here's the screenshot
formX.png
formX.png (27.48 KiB) Viewed 6629 times
As I wrote earlier, omitting the declaration of "x" resolves the problem. So I assume that "x" is a
reserved word in GamBas - is that right?
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Form X. is redefined incorrect in Class FMain

Post by stevedee »

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.
Post Reply