Page 1 of 2

Form X. is redefined incorrect in Class FMain

Posted: Tuesday 9th February 2021 1:45am
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

Re: Form X. is redefined incorrect in Class FMain

Posted: Tuesday 9th February 2021 3:14am
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

Re: Form X. is redefined incorrect in Class FMain

Posted: Tuesday 9th February 2021 4:57am
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

Re: Form X. is redefined incorrect in Class FMain

Posted: Wednesday 10th February 2021 2:05pm
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

Re: Form X. is redefined incorrect in Class FMain

Posted: Saturday 13th February 2021 3:43am
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!

Re: Form X. is redefined incorrect in Class FMain

Posted: Saturday 13th February 2021 4:45am
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?

Re: Form X. is redefined incorrect in Class FMain

Posted: Saturday 13th February 2021 6:00am
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/

Re: Form X. is redefined incorrect in Class FMain

Posted: Saturday 13th February 2021 9:37am
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 6953 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

Re: Form X. is redefined incorrect in Class FMain

Posted: Saturday 13th February 2021 4:55pm
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 6948 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?

Re: Form X. is redefined incorrect in Class FMain

Posted: Saturday 13th February 2021 6:31pm
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.