• Welcome to PlanetSquires Forums.
 

GraphicControlDemo and GraphicWindowDemo - FireFly with PB graphics functions

Started by Jean-pierre Leroy, January 16, 2010, 12:38:09 PM

Previous topic - Next topic

Jean-pierre Leroy

Dear FireFly users,

I'm happy to share with you two sample FireFly projects that illustrate how to use some PB graphics functions with FireFly.

The project called GraphicControlDemo use a Graphic Control and is based on the code provided by Paul Squires on this thread http://www.planetsquires.com/protect/forum/index.php?topic=2134.msg17935#msg17935

The project called GraphicWindowDemo use a Graphic Window and is based on the code provided by Roger Garstand on this thread http://www.powerbasic.com/support/forums/Forum6/HTML/004783.html

As you can see in the screenshots the results are the same with both options.

Notes:
   1. These projects could be compiled with PowerBASIC Include files or Jose ROCA Includes files
   2. As mentioned previously, the codes used in these projects come from Paul and Roger Garstand; I just try to put everything together on a sample project.
   3. These demo are not complete but could help some FF users to start using PB graphics functions with FireFly.

Questions:
   Q1. I don't know which method is the best one to use with FireFly ?
   Q2. Does someone can tell me how I can re-size the graphics when the form is re-sized ?

Your feedback is welcome
Jean-Pierre

Douglas McDonald

Jean-Pierre Leroy,

thank you, it may be just what I need for a  simple line graph

Doug
Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

David Warner

Hi Jean-Pierre,

great demo thanks for posting it.

Regarding your question (Q1) about which is the best method, I noticed that...

In the graphic control demo, after left clicking on the graph Alt-F4 closes the whole application.

In the graphic window demo, after left clicking on the graph Alt-F4 closes the graphic window only.

Either of these behaviours may be what someone desires.

Cheers,

David

Roger Garstang

Going to have to play with these.  I think Graphic Control works and looks better...I wish Window did since it should be the one easiest for FF, but PB screwed up how it is implemented.  Still draws off the form on startup since no options available, and clicking it then pressing Alt+F4 still closes it.

Jean-pierre Leroy

Dear FF users, I've just updated these two demo projects (.zip files at the beginning of this thread).

Now you can graph a function F of one variable X of your choice.

To do that:
1. I put a new FireTextBox to fill the function to be plotted.
2. I have included in these project a new function EvalExpNum() that I have released today on the PowerBASIC forum; this function can evaluate numerical and/or mathematical expressions; more information on the PowerBASIC forum here : http://www.powerbasic.com/support/pbforums/showthread.php?t=42644

Here are two interesting functions:

Example1:
Function Y = F(X) = x+(x^2/4)*sin(1/(x*PI/180))
X value FROM -10 TO 10 STEP 0.05

Example2:
Function Y = F(X) = log(x)*sin(x)
X value FROM 0 TO 13 STEP 0.05

Your feedback will be welcome.
Jean-Pierre

Jean-pierre Leroy

Dear FF users, due to some requests, I've just updated these two demo projects (.zip files at the beginning of this thread).

As you may be aware, all the PowerBASIC native trigonometric functions ATN , COS , SIN, and TAN use angles specified in radians; sometimes it is more intuitive to specify angles in degrees; so if you want to plot a graph with X value specified in degrees, just tick the CheckBox "Replace X by X*PI/180 (X is in degrees)".

Any question, do not hesitate to ask.
Jean-Pierre

Eddy Van Esch

Hi Jean-Pierre,

I just found your function plotting programs. They just came in handy to help my daughter with her math homework.  :)

I first ran the exe as included in the zip file. There I noticed something strange.
If I enter an x value in the 'from' textbox where: -1.0 < x < 0 and click 'Plot the function' then the x value is turned into a positive number: x = abs(x) and the function is plot with this positive starting coordinate.
I took a peek at the source code but couldn't find what might be causing it.

I then opened the source code of GraphicControlDemo with FF 3.60 and recompiled and then it worked fine.

Then I also tried to make the graphic custom control resize (I changed that in the visual designer) but resizing does not work. Maybe FF does not support resizing custom controls.

Anyway, just wanted to say thanks for your nice program!

Kind regards
Eddy