Event driven code versus waiting for userinput

Windows specific forum
Grumble
User
User
Posts: 31
Joined: Sun Jun 15, 2003 8:44 pm

Event driven code versus waiting for userinput

Post by Grumble »

I'm evaluating the trial version and looking at some examples, and I noticed that instead on having OnClick events (or OnMouseOver, or others) these examples work with Repeat-Until loops to wait for user input. At first sight I'd think this is a major disadvantage compared to some other languages (I have used RapidQ a lot), but I want to hear your opinion on this.
For example how would you deal with a Form with 20 buttons, changing the cursor whenever it's over a button. Is something like this as easy to do as with the OnMouseOver events that other languages have ?
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: Event driven code versus waiting for userinput

Post by tinman »

If you write all your code in procedures you can have the same style of handling events. So you write one procedure for each event of each gadget. The only difference is that you also have to write the code which catches the events and decides which procedure gets called.

In the other languages this event catching loop is hidden from you. But it works the same way.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

PureBasic catches all the events you list but just does it in a different way, there not wrapped up in 'cute' event handlers, you have to write the code to handle them yourself (which is not as bad as it sounds).

Also remember that when purchasing PB you get great support from all the guys here and from lead dev Fred. :)

Also regular updates are available in roughly about 2-3months intervals. Briefly looking at RapidQ it looks like it hasn't been updated for nearly 3 yrs (08.29.2000) ???
--Kale

Image
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

If you want the cute event handlers and stuff you can have it too!

Check out http://www.hellobasic.com/
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Fred
Administrator
Administrator
Posts: 18353
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

When the event loop is hidden, you can't do anymore some nice trick to groups the events or use non blocking event handler. This is two differents approaches, but both have the pro & con.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Kale wrote:PureBasic catches all the events you list but just does it in a different way...
Well you should be fair enough to tell that this is only true if you know WindowsAPI and use the WindowCallback as a second Event Loop in addition to the NORMAL Event Loop. And mostly it's all WindowsAPI.
So if you don't know Windows API you have to learn.
BTW: All has be done by hand. Some people say this is an advantage, others say it's a disadvantage.
IMO there are no disadvantages to have the GUI events automated...
Kale wrote: Also regular updates are available in roughly about 2-3months intervals. Briefly looking at RapidQ it looks like it hasn't been updated for nearly 3 yrs (08.29.2000) ???
But people are still using it (although there will be no updates anymore, because the project is abandoned)
RapidQ also has a Linux version that is AFAIK at the same function level as the Windows Version.
PureBasic has also a Linux Version but it's not at the same stage as the Windows Version - thats a fact!

So if you want to play with a programming language, you should know what you want/need and then figure out if it's available under that language. Also look at the core language itself - is it complete, will it ever be complete, and so forth.

I am to provide the public with beneficial shocks.
Alfred Hitshock
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: Event driven code versus waiting for userinput

Post by fsw »

tinman wrote:If you write all your code in procedures you can have the same style of handling events. So you write one procedure for each event of each gadget. The only difference is that you also have to write the code which catches the events and decides which procedure gets called.

In the other languages this event catching loop is hidden from you. But it works the same way.
Yes but you have less work :!:

Imagine you have an GUI event handler that with one line of code you call the procedures for all your Gadgets (it could be 1000 - it wouldn't matter)

or you have to SELECT CASE 1000 Gadgets and call the procedures by hand.
I prefer the first method.

I am to provide the public with beneficial shocks.
Alfred Hitshock
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Karbon wrote:If you want the cute event handlers and stuff you can have it too!

Check out http://www.hellobasic.com/
Let's see... $59 for a compiler, libraries, editor, visual designer, and more.

For $39 you get another visual designer with different event handling...
(BTW it isn't released for the latest PureBasic version)

Hmm...

I am to provide the public with beneficial shocks.
Alfred Hitshock
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Event driven code versus waiting for userinput

Post by ricardo »

Grumble wrote: At first sight I'd think this is a major disadvantage compared to some other languages (I have used RapidQ a lot), but I want to hear your opinion on this.
Its not a disadvantage, its a great possibilitie.
As Fred says, you can do manyother things.

In fact, you have the control on everything. Try it and after a few weeks you will find that its the best approach because its open to you how to use it.

About lazy to code eventhandler, you can write your own app that does the job for you, its easy.

PureBasic is 'plastic', you can model it in many ways.

Rapid-Q is nice, but nothing to do with PureBasic. In a near future you will look back to Rapid-Q and notice many limitations that PB dosen't have.
ARGENTINA WORLD CHAMPION
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

fsw:

Hey man, don't shoot the messenger :-)

There are a few more products out there like that too, I don't think that's the only one. Bounce around a little and maybe you'll find one more to your liking.

Personally I like the way PB works. Muuuuch more powerful IMHO.

There is always VB! *grin*
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Karbon wrote:fsw:

Hey man, don't shoot the messenger :-)
NEVER EVER :wink:

I am to provide the public with beneficial shocks.
Alfred Hitshock
Post Reply