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
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.
:)
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. :)
By the way, ToolTips per control is already in my bug tracker as a new feature suggestion.
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
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.
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
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.
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?
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.
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?
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.
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
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
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.
You are right Roger. And thanks for your help. Trying to call EgridNav and getting a hangup.
The Form Notify:
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
Function = EGRIDNAV(idCtrl,pNMHDR)
Case Else
End Select
End Function
The Receiving EgridNav:
Function EGRIDNAV(ByVal CtrlID As Long, byVal pNCode As NMHDR Ptr ) As Long
The code just crashes after compilation.
Hi Jeff,
I would assume from the looks of it that some code in the EGRIDNAV function is not playing well with FireFly during compile time.
Try loading the CODEGEN_PROJECT1_MAIN.bas file into PBEdit or JPro or similar and compile it from there. You will be able to get a better indication of what the true error is hopefully.
What exactly does EGRIDNAV do? Right now you are checking that the Notify came from the EGrid control, but do you need to only call EGRIDNAV at certain times? From the name, I'd guess it handles some type of navigation. So, does it need to be called for other messages from the EGrid control not related to navigation? EGrid may notify for every type of event like control creation, deletion, mouse over, etc. You may need to look at NMHDR and see what type of message it is and only call EGRIDNAV in certain cases.
Thanks Paul,
I did compile it in PBedit. It didn't give me an error during the compile. I realized I have much more conversion from EZGUI to do. This is good for me.
Roger,
EGRIDNAV handles most of the events from Egrid. It started out just being able to navigate the grid like one does in Excel, but it turned out to be much more. Here are some of the features:
Ctrl-Down,Ctrl-Up, Ctr-Left, Ctr-Right to navigate a series of numbers
Shift-Cursor expands selections
Copy to clipboard
Paste to Egrid or Excel
Delete
Undo and Redo
Select multiple ranges with mouse
Cell and range formatting (color, font, bold etc.)
Merge and Unmerge cells
Create lines
Wrap text
Speed Entry
Toggle Checkboxes
Checkbox status
Print Area
Export to Excel with formatting
Column and Row Header formatting
Pop up menu with right-Click
Double click to edit a cell
Insert or Delete Columns and Rows
A host of supporting functions and subs
If people are interested, I can post a working version for PB without EZGUI. I'm trying to create as much interest in EGRID32 as possible. A while back, Elias asked me to be a beta tester in exchange for a free copy. It's been a work in progress since then.
Jeff
Jeff
How many "Undo's" are allowed in FF3. Seems like very few!
Paul,
I can't get Egrid to work unless the Form's notification Sub returns the LPARAM. The EgridNotify UDT gets loaded from that. Is there any way you could add that?
Jeff
The pointer to the NMHDR is LParam. The CtrlID passed is also WParam. (See my previous post on the code in FireFly's internal message loop and you will see the variables passed in even named that)
So, he offered a free version for you to beta test? I just was offered a discounted rate and ended up short on cash and couldn't buy it. I beta tested a little way back a couple years ago now. Mostly the designer and creating it in FireFly...not much coding. I found a few bugs though for him. It is a good control. A little more than I need though. I need more of something simple like MLG that looks like an enhanced Listview to the user or Early Excel. No need for flashy stuff.
Hi Jeff,
If you don't feel comfortable dealing with the WM_NOTIFY message handler then you can handle it in the CUSTOM handler like this:
'--------------------------------------------------------------------------------
Function FORM1_CUSTOM ( _
hWndForm As Dword, _ ' handle of Form
wMsg As Long, _ ' type of message
wParam As Dword, _ ' first message parameter
lParam As Long _ ' second message parameter
) As Long
Select Case wMsg
Case %WM_NOTIFY
If wParam = IDC_FORM2_EGRID321 Then
' wParam holds the control id
' lParam holds pointer to NMHDR structure
Function = EGRIDNAV( wParam, lParam )
End If
End Select
End Function
I can sympathize with you in trying to convert your code from the EZGUI way of doing things. You will probably have to start to relearn concepts of basic Windows API programming. This is the same process I had to go through when I switched from Visual Basic to PB using the Win API. VB hid everything in events that removed you from the true Windows messages and notifications. In the long run, I am *very* happy that I took the time to learn WinAPI rather than investing my time in a library or DDT. The extra knowledge gained from knowing the Windows API is very liberating.
Thanks Roger and Paul. I finally was able to get Notify to pass the right values onto the Nav function. I was trying to pass pNMHDR as a pointer instead of just setting EGN = pNMHDR. I have a few bugs to work out. This has demystified a few things for me.
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
Local nCode As Long
Local EgridHandle As Long
egwHndl = hWndForm
EgridHandle = @pNMHDR.hwndFrom
nCode = @pNMHDR.Code
EGN = pNMHDR
Function = EGRIDNAV(EgridHandle, idCtrl,nCode)
Case Else
End Select
End Function
Based on the code that you posted, EGN is assigned but never used? Based on your parameters to EGRIDNAV you could simply do this?
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
Function = EGRIDNAV( @pNMHDR.hwndFrom, idCtrl, @pNMHDR.Code )
Case Else
End Select
End Function