Help with translation

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

Help with translation

Postby Jermy » Feb 24, 2018 12:06

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
Posts: 8347
Joined: Apr 22, 2009 12:46
Location: Paris (suburb), FRANCE

Re: Help with translation

Postby fxm » Feb 24, 2018 12:39

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

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

Re: Help with translation

Postby Jermy » Feb 24, 2018 15:50

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

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 3 guests