Beginning of FF3 newbie questions

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

Previous topic - Next topic

Jeffrey Smith

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.

Paul Squires

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.
Paul Squires
PlanetSquires Software

Roger Garstang

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.

Jeffrey Smith

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


Jeffrey Smith

How many "Undo's" are allowed in FF3.  Seems like very few!

Jeffrey Smith

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

Roger Garstang

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.

Paul Squires

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.

Paul Squires
PlanetSquires Software

Jeffrey Smith

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

Paul Squires

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

Paul Squires
PlanetSquires Software