Help with translation

New to FreeBASIC? Post your questions here.
Post Reply
Jermy
Posts: 14
Joined: Apr 12, 2016 10:29

Help with translation

Post by Jermy »

hi people

I am trying to translate this pb code into fb code, its almost working.

How do i fix ' error 264: Symbol not a CLASS, ENUM, TYPE or UNION type, before '.' in 'Select Case @pNMTV.hdr.idfrom' ?

Code: Select all

Type TV_HANDLES
   nNode1 as HANDLE
   nNode2 as HANDLE
   nNode3 as HANDLE
End Type

Dim Shared tvNodes as TV_HANDLES

Function FORM1_WM_CREATE ( _
                         hWndForm as HWnd, _          ' handle of Form
                         ByVal UserData as Integer _  ' optional user defined value
                         ) as Long

       Print hWndForm
       Print HWND_FORM1_TREEVIEW1
       TreeView_SetBkColor( HWND_FORM1_TREEVIEW1, &hfff0e1 )       'macro

   tvNodes.nNode1 = FF_TreeView_InsertItem( HWND_FORM1_TREEVIEW1, TVI_ROOT, "First Item" )
   tvNodes.nNode2 = FF_TreeView_InsertItem( HWND_FORM1_TREEVIEW1, TVI_ROOT, "Second Item" )
   tvNodes.nNode3 = FF_TreeView_InsertItem( HWND_FORM1_TREEVIEW1, TVI_ROOT, "Third Item" )

   Function = 0   ' change according to your needs
End Function

'--------------------------------------------------------------------------------
Function FORM1_CUSTOM ( _
                      hWndForm      as HWnd, _      ' handle of Form
                      wMsg          as UInteger,  _  ' type of message
                      wParam        as WPARAM, _    ' first message parameter
                      lParam        as LPARAM   _   ' second message parameter
                      ) as Long

  Dim nNode as Long 
  Dim pNMTV as NMTREEVIEW Ptr   '<--- use this pointer for Treeviews ?
  
  Select Case wMsg
     
     Case WM_NOTIFY

            pNMTV = lParam
            
            Select Case @pNMTV.hdr.idfrom    ' error 264: Symbol not a CLASS, ENUM, TYPE or UNION type, before '.' in 'Select Case @pNMTV.hdr.idfrom'
'            Select Case @pNMTV.hdr.idfrom 
'            
'                   Case IDC_FORM1_TREEVIEW1        
'                     
'                     Select Case @pNMTV.hdr.Code
'
'                           Case NM_CLICK    'left click         
'                           Case NM_DBLCLK   'left double-click
                           Case NM_RCLICK   ' right click

'                              nNode = FF_TreeView_GetSelection( HWND_FORM1_TREEVIEW1 ) 
'                              Print "Node right clicked: " & nNode  
'                           Case NM_RDBLCLK   'right double-click
'
'                     End Select
'                     
            End Select                      
  
  End Select

   Function = 0   ' change according to your needs
End Function
What am I doing wrong?
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Help with translation

Post by fxm »

Perhaps ?
Select Case pNMTV->hdr.idfrom
or
Select Case (*pNMTV).hdr.idfrom

Likewise further ?
Jermy
Posts: 14
Joined: Apr 12, 2016 10:29

Re: Help with translation

Post by Jermy »

Thanks fxm for the help, I need to get used to the syntax of fb
Post Reply