Create a new form
Create two buttons
Enter Test in "Event procedure" of both buttons
Press F5, error "Procedure is already declared: Test"
This is shown in the Procedures viewer
I'm unable to preview a form that uses the same procedure for multiple buttons due to this error but it works fine when including in a .pb
Yes, I could use different procedure names for each button but I'd like to be able to use the same one and still be able to check the layout of the form when hitting F5 on it due to it not being 100% WYSIWYG
Tested on:
Purebasic v5.31 x64 Windows 8.1
Purebasic v5.31 x86 Windows 8.1
Purebasic v5.31 x64 OSX 10.10.3
Editor: Procedure is already declared
Re: Editor: Procedure is already declared
Hit F5 on a .pbf does not really 'run' the file because it's not a 'real' code
To affect a same procedure to multipe object on a same form
- draw the form with your object
- affect your procedure to 1 (on only one) object
- change vue, and copy declaration line ie: 'Declare Test(EventType)'
- Go to your main code (.pb)
- Paste line and change 'Declare' by 'Procedure'
- write the rest of your procedure
- return to the form
- go to the other object
- pull down 'event procedure'
- your procedure appears, select it
- return to code (.pb)
- F5
PS. In all case, when you use more than one file, use project. With Project, you can hit F5 whatever the file where you were.
To affect a same procedure to multipe object on a same form
- draw the form with your object
- affect your procedure to 1 (on only one) object
- change vue, and copy declaration line ie: 'Declare Test(EventType)'
- Go to your main code (.pb)
- Paste line and change 'Declare' by 'Procedure'
- write the rest of your procedure
Code: Select all
XIncludeFile "test.pbf"
Procedure Test(EventType)
Debug "Hello"
EndProcedure
- go to the other object
- pull down 'event procedure'
- your procedure appears, select it
- return to code (.pb)
- F5
PS. In all case, when you use more than one file, use project. With Project, you can hit F5 whatever the file where you were.
Re: Editor: Procedure is already declared
I beg to differ and my task manager agrees with me:Marc56us wrote:Hit F5 on a .pbf does not really 'run' the file because it's not a 'real' code
I think the point of having the ability to F5 a form is to view it in its RAW form without any code behind being run to alter it is great.
This is a great feature as it allows the rapid development of a form, checking it with F5 when changes are made to make sure it still "looks" ok etc.
Even if I don't hit F5 and select Compiler>Syntax Check it still comes back with the same error, even though this error wont occur it it is included and used in a .pb
Therefore I think this is a bug as something doesn't seem to be checking if the procedure declaration has already been added to the file.