FireFly Visual Designer for FreeBASIC (Updated March 8, 2016)

User projects written in or related to FreeBASIC.
Post Reply
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2

Post by PaulSquires »

Here is an easy way to ensure that your graphs paint correctly whenever they are covered/uncovered or minimized/maximized:

Code: Select all

Dim Shared fAllowChartLine As BOOLEAN
 
'--------------------------------------------------------------------------------
Function FORMMAIN_COMMANDCHARTLINE_BN_CLICKED ( _
                                              ControlIndex     As Integer, _   ' index in Control Array
                                              hWndForm         As hWnd, _      ' handle of Form
                                              hWndControl      As hWnd, _      ' handle of Control
                                              idButtonControl  As Integer   _  ' identifier of button
                                              ) As Integer

    fAllowChartLine = True
    FF_Control_Redraw HWND_FORMMAIN_PICTURECHARTLINE
     
End Function


'--------------------------------------------------------------------------------
Function FORMMAIN_PICTURECHARTLINE_WM_PAINT ( _
                                            ControlIndex  As Integer,  _  ' index in Control Array
                                            hWndForm      As hWnd, _      ' handle of Form
                                            hWndControl   As hWnd  _      ' handle of Control
                                            ) As Integer

   ' fAllowChartLine is a global variable flag that enables/disables the 
   ' painting of the ChartLine graph
   
   If fAllowChartLine Then

      Draw_Axes(HWND_FORMMAIN_PICTURECHARTLINE, -3, -30, 3, 30, _
                "y = x^2 und y = x^3, x = -3 bis +3, y = -30 bis + 30")
      Chart_Line(HWND_FORMMAIN_PICTURECHARTLINE, y(), BGR_Blue)
      Chart_Line(HWND_FORMMAIN_PICTURECHARTLINE, z(), BGR_Red)

      ' Because we have painted the control ourselves then we don't want 
      ' Windows to continue on with the painting process and erasing what
      ' we have just painted. Simply validate the dirty rectangle.  
      ValidateRect hWndControl, ByVal 0
      
   End If
   
End Function
Lothar Schirm
Posts: 491
Joined: Sep 28, 2013 15:08
Location: Germany

Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2

Post by Lothar Schirm »

Thank you, it works fine! I see WinAPI is a little bit tricky. Up to now, I have always opened a "normal" FreeBasic graphis window with "Screenres" in order to draw my diagrams, while FireFly is used to provide the GUI. May be it is easier to stay with this method, because I have already programmed a lot of code with the FB graphics library for charts, 3D function plots and small animations which I would not like to invent again with WinAPI. Or do you intend to include graphics functions into your new WinAPI library?
Lothar Schirm
Posts: 491
Joined: Sep 28, 2013 15:08
Location: Germany

Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2

Post by Lothar Schirm »

Hello Paul,

I begin to work again on drawing diagrams into a picture. Your proposal works well when I want to draw the diagram only once, but how can I draw a new diagram into the same picture so that it cannot be erased? I guess that is not possible with the WM_PAINT function?
Lothar Schirm
Posts: 491
Joined: Sep 28, 2013 15:08
Location: Germany

Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2

Post by Lothar Schirm »

My package for drawing different types of charts into a picture control can be downloaded here: http://www.freebasic-portal.de/download ... y-345.html.
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by PaulSquires »

Updated the original post to reflect a new uploaded FireFly 3.70 package.

The purpose of this upload to integrate the FreeBasic code generation directly into the latest FireFly 3.70 product. Future FreeBasic updates will be easier to release now that the commercial FireFly product can generate both the commercial PowerBasic code and the freeware FreeBasic code.
jcfuller
Posts: 325
Joined: Sep 03, 2007 18:40

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by jcfuller »

Paul,
32bit win only or is 64bit supported?

James
Kot
Posts: 336
Joined: Dec 28, 2006 10:34

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by Kot »

One tiny thing, the icon for FreeBasic help has PB letters and "PowerBASIC Help" tooltip :-)
Loe
Posts: 323
Joined: Apr 30, 2006 14:49

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by Loe »

Paul, where is the updated ff3.7?
in the download link it still ff3.5
**edit
my mistake, after reload download page it is ff3.7
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by PaulSquires »

jcfuller wrote:Paul,
32bit win only or is 64bit supported?

James
32 bit only because the 64 bit win apii headers are not translated yet. dkl indicated that he is working on that.
jharre
Posts: 2
Joined: Feb 06, 2015 23:22

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by jharre »

I'm definitely a newbie with FB, and thought I'd play with this. Now I'm just confused.

I didn't see any installer, so I extracted the contents of the Firefly_FB_370.rar file to my C:\FreeBasic folder. After doing so, it seems all the folders are read-only. Indeed, when opening a new project in FireFly, the result is: "Error: Unable to create main project folder." (And if you hit "OK" and then attempt to quit and save, another dialog box complains that the folder is read-only and I need to reinstall using the "My Documents" option.) Oops! Can't do that.

Looking at the help file, it does say that Inno Setup is used in the How to Install and Uninstall section. Is the help just not current? Or, am I doing something really boneheaded here? I'm using 64-bit Win8.1 if that makes a difference.

I'd really like to try FireFly for FB.

<*> Jim

Edit: I did try extracting to a folder in "My Documents" and also on my desktop - same results
Linuxbob
Posts: 61
Joined: Sep 01, 2010 1:03
Location: Ohio, USA

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by Linuxbob »

I have a question that I didn't see an answer for. I have a program for an electrical engineering analysis that I wrote originally in VB. As a learning exercise, I am reworking/improving it in FreeBASIC and Firefly. The organization of the analysis inputs lends itself to grouping the inputs into several subgroups, within each of which are a few controls (textboxes, check boxes or option buttons.) Here is my first problem: I don't seem to be able to draw a control directly on top of a frame; after selecting the control in the tool box, as soon as I click inside the frame, the focus jumps immediately to the frame. I can draw the control on the form and then move it to the frame. Here is my second problem: after I move the control onto the frame, I can't select it again. Any attempt to left-click the control will immediately select the frame. I can right-click on the control and get the context menu with no problem. I am using FF 3.70.

What am I missing?
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by PaulSquires »

Updated the first post to reflect the newly available download FireFly 3.71. There is no installer so simply extract the files. Fixed the bug that was causing the initial project folder to fail to be created resulting in "read only" error messages.

Here are all the changes:
- 0000892: [New Feature Request] FB: Added 2>&1 to _compiletemp.bat batch file to redirect stderr output to log file in addition to stdout (Paul Squires) - closed.
- 0000891: [New Feature Request] Added default Function = 0 to all message handlers (mainly to suppress FB compiler warnings) (Paul Squires) - closed.
- 0000890: [New Feature Request] FB: Added the project name prefix to the _compile batch and compiler output log filenames (Paul Squires) - closed.
- 0000889: [New Feature Request] Project Properties: Dynamically update project folder name when user changes Project name (Paul Squires) - closed.
- 0000888: [Bug] New Projects: Failure to create folder structure when root project folder does not already exist (Paul Squires) - closed.
- 0000883: [Bug] GDI resource leak when Form background color not a system color (Paul Squires) - closed.
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by PaulSquires »

Linuxbob wrote:I don't seem to be able to draw a control directly on top of a frame; after selecting the control in the tool box, as soon as I click inside the frame, the focus jumps immediately to the frame. I can draw the control on the form and then move it to the frame.
Unfortunately, that is what you will have to do because in FireFly (and the WinAPI in general), a Frame is not a container control. Sorry.
after I move the control onto the frame, I can't select it again. Any attempt to left-click the control will immediately select the frame. I can right-click on the control and get the context menu with no problem. I am using FF 3.70.
That's odd. I have no problems being able to select any of the controls. The Frame is not taking precedence over any of the other controls within its boundaries. You might want to download the updated files in the original post to see if that problem still exists.
jharre
Posts: 2
Joined: Feb 06, 2015 23:22

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by jharre »

PaulSquires wrote: - 0000888: [Bug] New Projects: Failure to create folder structure when root project folder does not already exist (Paul Squires) - closed.
That fixed it, Paul. After extracting the 3.71 version, I was able to save the project, create a simple form, compile and run.

Thank you!

<*> Jim
Linuxbob
Posts: 61
Joined: Sep 01, 2010 1:03
Location: Ohio, USA

Re: FireFly Visual Designer for FreeBASIC (Updated Jan 10, 2

Post by Linuxbob »

Unfortunately, that is what you will have to do because in FireFly (and the WinAPI in general), a Frame is not a container control. Sorry.
I knew that about the frame (same behavior as in a straight C environment,) just didn't know if there was a way to make the FF designer assume I was trying to place a new control instead of selecting an object already in the interface when the Tools tab was open and I had just selected a control. This I can deal with.
That's odd. I have no problems being able to select any of the controls. The Frame is not taking precedence over any of the other controls within its boundaries. You might want to download the updated files in the original post to see if that problem still exists.
Sorry, I didn't describe the setup well enough. Where there is only one frame under the control, I don't have an issue selecting the control on the frame. This problem only seems to happen if I place a control on a frame that is already on top of another frame (visually nested frames). Bringing the control to the front doesn't help. But the right-click will correctly select the control and bring up the context menu in favor of both frames. If I move the inner frame off the outer frame without moving the control, the control selects correctly above the single outer frame. Same if I move the second frame and the control off the first frame: no problem selecting the control. Now, if I draw the control before I draw the second frame, then move the control on top of both frames then the visual designer selects the control correctly so the drawing order is apparently significant. That's important because if I have laid out the interface and later decide I need to add another control, I'm hosed.

I realize this is probably an obscure case but for the engineering work I do this comes up a lot.
Post Reply