It is currently Thu Apr 25, 2019 10:58 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: No Generate event loop in Windows version 5.6.
PostPosted: Tue Apr 25, 2017 10:46 pm 
Offline
New User
New User

Joined: Tue Apr 25, 2017 10:00 pm
Posts: 1
I am trying the demo version 5.6 in Windows. In my Form preferences there is no option to automatically generate an event loop in the Form Designer. Consequently the loop isn't included and obviously I can't edit the .pbf file to include it. Also there is no event file box in the window's properties just an event procedure box. I have created an event file but do not seem able to trigger an event. Sorry if I am missing something basic but could someone advise please?


Top
 Profile  
Reply with quote  
 Post subject: Re: No Generate event loop in Windows version 5.6.
PostPosted: Tue Apr 25, 2017 11:29 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Feb 01, 2012 3:30 pm
Posts: 707
Location: Nottinghamshire UK
Hi Franb take a look at one of our new members Visual designer implementation, still work in progress it will provide you with full working code and event procedure. As your using a demo you will be limited to compiling 800 lines of code at most. The Zip Download for SweetyVD come with the visual designer pre compiled as 64bit exe if you need an 32bit exe just request one myself or someone here will compile you the code should you want it.

Zebuddi. :)

https://github.com/ChrisRfr/SweetyVD

_________________
malleo, caput, bang. Ego, comprehendunt in tempore


Top
 Profile  
Reply with quote  
 Post subject: Re: No Generate event loop in Windows version 5.6.
PostPosted: Wed Apr 26, 2017 5:14 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 3:47 am
Posts: 2195
Location: Singapore
franb wrote:
I am trying the demo version 5.6 in Windows. In my Form preferences there is no option to automatically generate an event loop in the Form Designer.

The newer versions of the form designer have removed the option for generating the event loop, freeing the programmer to process events at their discretion. This is a very minor change that only requires the main event loop to be included in an external file.

Following this small tutorial, Events Handling with the Form Designer, under the section of Using PureBasic Forms, the events file is created in step 10:
Code:
XIncludeFile "MyForm.pbf"

Procedure buttonEvent(eventType.i)
  ;get the text from the text box (identifier = String_0)
  text$ = GetGadgetText(String_0)
 
  ;and place it in the label (identifier = Text_0)
  SetGadgetText(Text_0, text$) 
EndProcedure

Now, simply add the call to the main window procedure and include the main event loop here, like so:
Code:
XIncludeFile "MyForm.pbf"

Procedure buttonEvent(eventType.i)
  ;get the text from the text box (identifier = String_0)
  text$ = GetGadgetText(String_0)
 
  ;and place it in the label (identifier = Text_0)
  SetGadgetText(Text_0, text$) 
EndProcedure


;ADDITION #1: call to the main window procedure
OpenWindow_0()

;ADDITION #2: the main event loop
Repeat
  event = WaitWindowEvent()
Until Window_0_Events(event) = #False

That's all! :wink:

_________________
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!


Top
 Profile  
Reply with quote  
 Post subject: Re: No Generate event loop in Windows version 5.6.
PostPosted: Wed Apr 26, 2017 8:41 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Nov 25, 2013 6:41 am
Posts: 764
Here's another
http://www.purebasic.fr/english/viewtopic.php?f=27&t=68334&p=506355#p506014


Top
 Profile  
Reply with quote  
 Post subject: Re: No Generate event loop in Windows version 5.6.
PostPosted: Fri Apr 28, 2017 2:47 pm 
Offline
User
User
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 84
Location: France
TI-994A wrote:
franb wrote:
Now, simply add the call to the main window procedure and include the main event loop

It's one of the negative points of PB Form, It would be really nice to have a revision on these 2 points.
It is tiring to have to copy the code into a new tab to be able to add those changes.
In the same way, it would be good to be able to add codes without being destroyed during the Code/Form flip-flop.

@mestnyi It is good to have some challenger, in the good way, not a competition but a good stimulation.


Top
 Profile  
Reply with quote  
 Post subject: Re: No Generate event loop in Windows version 5.6.
PostPosted: Sat Apr 29, 2017 4:36 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 3:47 am
Posts: 2195
Location: Singapore
Firstly, they're both great works in progress. Some way to go, so, good luck to both of you.

ChrisR wrote:
It is tiring to have to copy the code into a new tab to be able to add those changes.
That is not necessary, as any changes could be saved as regular source files before switching back to design view. But that's not the intended implementation of these form files. They are meant to be used as standalone user interface files that are included and called by the main program. All event processing should be performed within the main program and not in these reusable form files.

ChrisR wrote:
...it would be good to be able to add codes without being destroyed during the Code/Form flip-flop.
Not impossible, but the parser would have to work overtime.

BTW, how are the SweetyVD form files saved for future editing? :wink:

_________________
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!


Top
 Profile  
Reply with quote  
 Post subject: Re: No Generate event loop in Windows version 5.6.
PostPosted: Sat Apr 29, 2017 4:07 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1677
Location: Germany
Caution Advertising.

The event creation I found from Visual designer never as I would have liked.
Therefore I use my tool EventDesigner.
This creates not only the event loop, but also all necessary event-procedures. Subsequent changes are also no problem.

I like to use the visual designer.

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: No Generate event loop in Windows version 5.6.
PostPosted: Mon May 01, 2017 12:21 pm 
Offline
User
User
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 84
Location: France
Yes TI-994A, I use PB Form like that, now.
But at the very beginning, it was a concern for me, as probably for others
For a beginner it would be good to have OpenWindows writen in source and the event loop reviewed
To be able to run Out Of the Box, after copying the source in a new Tab.
And I beleive that the Code generation is not the most complicated part in PB Form.

About editing, it is indeed more complicated.
It should probably be done by reading the source and with perhaps some tags (eg: ;//Begin_PB_Form => //End_PB_Form)
But well, it's not really essential.
And as you suppose, for my "little" tool, I have no plan yet and it is far for now, for such feature :wink:
It is already hard to find time for more complicated things as Container or multiple selection.
It is open source for that, for the pleasure of sharing and for possible contribution but without success for now :cry:

Thanks mk-soft for your eventdesigner :)
I do not know it and I just tested, that's a great addition, especially for large Apps.
It could be an usefull option in a VD.
I would be happy to add it in future, if I go further and if you allow.

Another Idea i have, is to choose a template (skeleton) file for the code generation.
With a preference file and Section to be copied at generation time, like:
Code:
[IncludeFile]

[enumeration]
Line01=#MyFont

[Declare]

[Procedure]
Line01=LoadFont(#MyFont, "Verdana", 8)

[Initialisation]

[EventLoop]

[Exit]


Top
 Profile  
Reply with quote  
 Post subject: Re: No Generate event loop in Windows version 5.6.
PostPosted: Mon May 01, 2017 3:02 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 3:47 am
Posts: 2195
Location: Singapore
ChrisR wrote:
...it would be good to have OpenWindows writen in source and the event loop reviewed To be able to run Out Of the Box, after copying the source in a new Tab.
Technically, form files are purely intended for the design and layout of user interfaces. It is the same with Visual Studio's form designer, Android Studio's layout editor, and even XCode's interface builder; all the forms comprise of static code purely for the creation of the UI and nothing more. They have to be linked to external code modules for event processing.

It's true that the PureBasic form designer initially allowed the inclusion of the event loop within its form files; but in line with current best practices of visual interface builders, the option was removed for better conformity. It is important for beginners to embrace this modular approach, as it would be helpful when crossing between development platforms. :wink:

_________________
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!


Top
 Profile  
Reply with quote  
 Post subject: Re: No Generate event loop in Windows version 5.6.
PostPosted: Mon May 01, 2017 9:56 pm 
Offline
User
User
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 84
Location: France
Thanks for your explanation and the history.
I understand for advanced users and for learning the modular approach.

But for me, I have trouble understanding this choice for newbie.
with the option generate event procedure enabled by default during PB install.
A functional code, Out Of The Box should be a priority for me with this option. Regular and advanced users know what to do.
Well, it's probably only my point of view :wink:


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye