Beginning of FF3 newbie questions

Started by Jeffrey Smith, January 13, 2011, 07:52:11 PM

Previous topic - Next topic

Jeffrey Smith

Ok, after all the raving I've been hearing about Firefly, I had to try it.  I've been looking at it for a couple of days.  Hope you guys and gals can take it easy on a new user.  I've been using EZGUI and have been isolated from the raw Powerbasic commands.  EZGUI has brought me into the Windows programming environment after many years of just creating small in-house utilities in DOS.  I'm now creating applications that the public is using.  Enough drivel.

I really like the layout and I know I'm going to get used it.  So far my experience is positive.

I added a few controls including an Egrid control.  I found out which folder to copy my licensed copy of EGRID32 and the file to edit to change the term "demo" to "Licensed" so it would show in the control window.

Can I not reconfigure FF3 to create a single "event" SUB for a control and then parse the events using Select Case?  Rather than having a single sub for each control event.

In Jellyfish Pro I used to hit F4 and get a list of Subs, now it's F9.  Can that be changed?  If not, I'll have to train my brain.  In JFP when I hit F4 it would put the selector on the current sub.  It was nice to be able to navigate to similar named subs or to simply goto the top of the current sub.  When navigating through the subs and functions, I'm not able to hit enter to select one, I can only use my mouse.

I have to applaud the property control window.  Incredibly functional and intuitive.

How to I create a tooltip for a control? What are tag and tag2 used for?

Does the editor save all the modules before compiling?  There is no indicator that a module has changed since the last save.  JFP used to put an astrisk in the Tab next to the module name when changes had not been saved.

I have an include file that depends on the constants, subs and functions of a custom control include file.  When I put the include statement at the bottom of FF_AppStart (#INCLUDE "B:\Test\Modules\EGrid_Navigate.inc"), the compiler reads this first before loading the custom control include file.  Errors pop up all over the place.  Where can I add my include statements so they get compiled after the custom control include statements?  {UPDATE}  I noticed if I added the include file as a module, it put the include file in the code for me.

This is enough for now.  Thanks for any responses.

Jeff







Paul Squires

Quote from: Jeffrey Smith on January 13, 2011, 07:52:11 PM
Ok, after all the raving I've been hearing about Firefly, I had to try it.  I've been looking at it for a couple of days.  Hope you guys and gals can take it easy on a new user.  I've been using EZGUI and have been isolated from the raw Powerbasic commands.  EZGUI has brought me into the Windows programming environment after many years of just creating small in-house utilities in DOS.  I'm now creating applications that the public is using.  Enough drivel.

Hey Jeff - great to have you here buddy! Lots of good FireFly programmers around here. Many users here provide the answers often before I even get a chance to read the questions. :)

Quote
Can I not reconfigure FF3 to create a single "event" SUB for a control and then parse the events using Select Case?  Rather than having a single sub for each control event.

Check out the "CUSTOM" event handler. You can handle everything through there except for "WM_CREATE" messages.

Quote
In Jellyfish Pro I used to hit F4 and get a list of Subs, now it's F9.  Can that be changed? 
No, it can't - sorry. I had to retrain my brain as well. I rarely need to use JPro anymore. Mostly just for creating standalone DLL's with no GUI components in them.

Quote
I have to applaud the property control window.  Incredibly functional and intuitive.

Thanks! It is a knockoff of the Microsoft Visual Basic/C/Studio types of products.

Quote
How to I create a tooltip for a control?

I believe there are many examples in this forum. Do a simple search. Roger Garstang has posted several comprehensive samples.

Quote
What are tag and tag2 used for?

Basically, you can store whatever you want in those that has meaning for you in the context of your program. They are simply strings and can represent anything that you want them to. For example, a record number or format information, etc...

Quote
Does the editor save all the modules before compiling? 

Yes, definitely.

Keep the questions coming.

:)
Paul Squires
PlanetSquires Software

Paul Squires

You will find that when you invest the time to learn the basics of dealing with Windows controls via the Windows API that it is very liberating. The "mystery" disappears and suddenly you wonder what all the fear, uncertainty and doubt is all about with people saying that the win api is too hard. Rubbish. It is like anything - you get out of it the effort that you put into it.  :)
Paul Squires
PlanetSquires Software

Paul Squires

By the way, ToolTips per control is already in my bug tracker as a new feature suggestion.
Paul Squires
PlanetSquires Software

Douglas McDonald

As far as tool tips go it seems there are a few different ways. this works for me. Include tooltips.inc (attached) then place your tooltip code in wm_creat


Function MAIN_WM_CREATE ( _
                        hWndForm As Dword, _      ' handle of Form
                        ByVal UserData As Long _  ' optional user defined Long value
                        ) As Long

'setup toolTips
SetToolTip HWND_MAIN, IDC_MAIN_OPCHECK(0), "Minimize all active windows, everything on the screen"
SetToolTip HWND_MAIN, IDC_MAIN_OPCHECK(1), "Minimize all from action list"
SetToolTip HWND_MAIN, IDC_MAIN_OPCHECK(2), "Beeps or plays sound"
SetToolTip HWND_MAIN, IDC_MAIN_OPCHECK(3), "Close, Exit selected program(s) ** Data may be lost PLEASE READ THE MANUAL**"
SetToolTip HWND_MAIN, IDC_MAIN_BUTTON(0),  "Add selected program from active programs to action list"
SetToolTip HWND_MAIN, IDC_MAIN_BUTTON(1),  "Remove program from action list"
SetToolTip HWND_MAIN, IDC_MAIN_BUTTON(2),  "Refresh active programs list"
SetToolTip HWND_MAIN, IDC_MAIN_BUTTON(3),  "Ping / get status of motion sensor"
SetToolTip HWND_MAIN, IDC_MAIN_BUTTON(4),  "Actavate settings, motion sensor and minimize program "
SetToolTip HWND_MAIN, IDC_MAIN_BUTTON(5),  "Exit, no futher action taken if motion sensor trips "


End Function



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

Roger Garstang

If you use my tooltip code, be sure it is the most recent.  Some of the first had goofy errors like an Optional ByRef parameter, and I made a change for XP Themes so when the hover effect on buttons and other controls draws it doesn't draw the tip twice.  Jose has some code for tooltips too that help understand them even further.  Mine also has the ability for manual tooltips that you draw and the user pops, but you will have to do some research on how to use them.

As far as the rest, Paul answered already.  I usually have just 3 events in most of my apps- Create, Destroy, and the Form's Custom handler to do the rest.  With small apps using just a couple buttons I may use the built in events, but I really like the Custom handler more.

Jeffrey Smith

Thanks for all the input.

Roger, I'll be looking into the tooltip code soon.

Paul,
QuoteBy the way, ToolTips per control is already in my bug tracker as a new feature suggestion.
Here here!

hmmm, sometimes when I'm looking too hard for something, I look right past it.  Can someone point me in the right direction to find the Custom event handler.  For some reason, my version of FF3 help has no search capability.

Jeff

Paul Squires

Quote from: Jeffrey Smith on January 17, 2011, 12:43:48 PM
Can someone point me in the right direction to find the Custom event handler.

Check out the section called "Code Editor" located under the "The User Interface" branch in the Help file.
Paul Squires
PlanetSquires Software

Jeffrey Smith

Somehow I ended up creating an error 466 - Duplicate Name Definition in my project.  At no time was the cursor placed on where the error was.  I erased the Form1 and started over with a new form called Form2.  For some reason the CODEGEN file for Form1 was still trying to compile.  Isn't the code for deleted controls and forms supposed to be automatically removed from the project?

Roger Garstang

#9
FireFly's internal code that creates the controls will be removed, but any event code you create will remain.  I think there was something on the wish list for renaming control handles and such in code when they are renamed in the GUI Designer, but I don't think I'd want it to delete my event code.  Sometimes I may want to switch a control type like textbox to label or listbox to combobox and will then go back to my event code and change handle names and/or API calls to modify the new control type.  If it deleted code there too I may have a lot of work to do for a simple restructure of my GUI interface.  It also sounds like the FireFly Project may have had Form1 added to it and you deleted at the Windows level too.  You can delete it from the Project and leave it at the file level or delete both.

This is another reason why the Custom handler is good too since only one location to look in for code.  The Custom Handler is under a few controls for specific things, but mostly I use the Form's Custom event too if you were still trying to find it.

In the event of errors PB doesn't provide much detailed info for Paul to work with.  If you have it selected not to delete the Codegen files you can open the MAIN file in the PB IDE and compile it to see the exact location/file containing the error.

Jeffrey Smith

I should probably put these questions in their own topic.

When a custom control is created, is this a Callback Function?
Function FORM2_EGRID321_CUSTOM ( _
                               ControlIndex  As Long,  _  ' index in Control Array
                               hWndForm      As Dword, _  ' handle of Form
                               hWndControl   As Dword, _  ' handle of Control
                               wMsg          As Long,  _  ' type of message
                               wParam        As Dword, _  ' first message parameter
                               lParam        As Long   _  ' second message parameter
                               ) As Long


I'm trying to convert some code I use for all Egrid controls.  I have all the event handling in one include file.  I was using EZGUI to create a Notify Sub Like this:
Sub ITABLEFORM_ITABLE_Notify(ByVal CVal&, Cancel&)

  CANCEL& = EGRIDNAV(Cval&, "iTableForm")   'Excel navigation and more
End Sub


The EGridNav Function would be called and then retrieve the notification message and process it.

I need to have a callback function for the Egrid that can process the msg, test to see if it is the WM_Notify, then send the notification message and the control handle onto the EGridNav Function.  Does FF3 help create the Callback?

Roger Garstang

#11
Your form will have a WM_NOTIFY event and it can be in the form's CUSTOM event too checking the msg for %WM_NOTIFY. I don't use Egrid so I may not be much help other than that.  Usually a control like Listviews and complex controls like Egrid will send the WM_NOTIFY to the parent form.  I wouldn't think you would do anything in EGrid's Custom except for Egrid messages not in the list.

Jeffrey Smith

How do I use the Notify Event for the form?  I need to test if the control sending the messge is the Egrid control. Then test if the message is in fact a %WM_Notify.  Then pass the notification message.

Function FORM2_WM_NOTIFY ( _
                         hWndForm     As Dword,     _  ' handle of Form
                         idCtrl       As Dword,     _  ' control ID
                         ByVal pNMHDR As NMHDR Ptr  _  ' pointer to NMHDR structure
                         ) As Long

Select Case idCtrl
   
    Case IDC_FORM2_EGRID321
      'No wMsg to test for WM_Notify
      'No NMCode to pass to the Nav Function
      egID = IDC_FORM2_EGRID321
    Case Else
   
  End Select
End Function

Roger Garstang

Internally FireFly has code it processed in WM_NOTIFY already and the EGN_ events you select in the Egrid control are called from the Form's internal msg loop's WM_NOTIFY right after any code you have in the Form's WM_NOTIFY unless you return TRUE from WM_NOTIFY then it is skipped.

FireFly's internal msg loop/callback

       Case %WM_Notify
          FLY_nResult = FORM1_WM_NOTIFY (hWndForm, wParam, lParam)
             If FLY_nResult Then Function = FLY_nResult: Exit Function

          If (@FLY_pNotify.idFrom = IDC_FORM1_EGRID321) And (@FLY_pNotify.Code = %EGN_LEFTDOUBLECLICK) Then
             FLY_nResult = FORM1_EGRID321_EGN_LEFTDOUBLECLICK (FLY_ControlIndex, HwndForm, @FLY_pNotify.HwndFrom, wParam, lParam)
             If FLY_nResult Then Function = FLY_nResult: Exit Function
          End If           

Roger Garstang

#14
I posted above just as you posted which actually answered part of it.  In FORM2_WM_NOTIFY you already know you are getting the WM_NOTIFY msg since internally FireFly calls your FORM2_WM_NOTIFY when it's message loop gets it, so all you need to do is any checking of control id or Notification Msg header value that gets passed on to your FORM2_WM_NOTIFY.

In Case IDC_FORM2_EGRID321 you have confirmed it came from egrid, so do what you need to right there.