Page 2 of 2

Posted: Sat Apr 16, 2005 3:49 pm
by El_Choni
Ok, my fault: #WM_NOTIFY is caught from the main window proc.

Here is working code, although it does nothing, since the data was already ordered:

Code: Select all

; RaGrid.Inc:
; From RaGrid zip, http://radasm.visualassembler.com/projects/Grid.zip

;GridInstall         PROTO   :DWORD
;
;;Column structure
;COLUMN struct
;   colwt         dd ?   ;Column width.
;   lpszhdrtext      dd ?   ;Pointer to header text.
;   halign         dd ?   ;Header text alignment.
;   calign         dd ?   ;Column text alignment.
;   ctype         dd ?   ;Column data type.
;   ctextmax      dd ?   ;Max text lenght for TYPE_EDITTEXT and TYPE_EDITLONG.
;   lpszformat      dd ?   ;Format string for TYPE_EDITLONG.
;   himl         dd ?   ;Handle of image list. For the image columns and combobox only.
;   hdrflag         dd ?   ;Header flags. Set to ZERO or if initially sorted set to initial sort direction
;   colxp         dd ?   ;Column position. Internally used.
;   edthwnd         dd ?   ;Column control handle. Internally used.
;COLUMN ends
;
;ROWCOLOR struct
;   backcolor      dd ?
;   textcolor      dd ?
;ROWCOLOR ends
;
;;Notifications GN_*
;
;GRIDNOTIFY struct
;   nmhdr         NMHDR <?>
;   col         dd ?   ;Column
;   row         dd ?   ;Row
;   hwnd         dd ?   ;Handle of column edit control
;   lpdata         dd ?   ;Pointer to data
;   fcancel         dd ?   ;Set to TRUE to cancel operation
;GRIDNOTIFY ends
Structure GRIDNOTIFY
   nmhdr.NMHDR
   col.l
   row.l
   hwnd.l
   lpdata.l
   fcancel.l
EndStructure 

#GM_ADDCOL = #WM_USER+1 ;wParam=0, lParam=lpCOLUMN
#GM_ADDROW = #WM_USER+2 ;wParam=0, lParam=lpROWDATA (can be NULL)
#GM_GETCURROW    = #WM_USER+12   ;wParam=0, lParam=0
#GM_SETBACKCOLOR = #WM_USER+21 ;wParam=nColor, lParam=0
#GM_SETGRIDCOLOR = #WM_USER+23 ;wParam=nColor, lParam=0
#GM_SETTEXTCOLOR = #WM_USER+25 ;wParam=nColor, lParam=0
#GM_SETHDRHEIGHT = #WM_USER+31   ;wParam=0, lParam=nHeight
#GM_SETROWHEIGHT   = #WM_USER+33   ;wParam=0, lParam=nHeight
#GM_COLUMNSORT    = #WM_USER+35   ;wParam=nCol, lParam=0=Ascending, 1=Descending, 2=Invert

#GN_HEADERCLICK   = 1   ;User clicked header

#GA_ALIGN_LEFT = 0
#GA_ALIGN_RIGHT = 2
#TYPE_EDITTEXT = 0   ;String
#TYPE_EDITLONG = 1   ;Long
#SORT_INVERT = 2

;
;GN_HEADERCLICK      equ 1   ;User clicked header
;GN_BUTTONCLICK      equ 2   ;Sendt when user clicks the button in a button cell
;GN_CHECKCLICK      equ 3   ;Sendt when user double clicks the checkbox in a checkbox cell
;GN_IMAGECLICK      equ 4   ;Sendt when user double clicks the image in an image cell
;GN_BEFORESELCHANGE   equ 5   ;Sendt when user request a selection change
;GN_AFTERSELCHANGE   equ 6   ;Sendt after a selection change
;GN_BEFOREEDIT      equ 7   ;Sendt before the cell edit control shows
;GN_AFTEREDIT      equ 8   ;Sendt when the cell edit control is about to close
;GN_BEFOREUPDATE      equ 9   ;Sendt before a cell updates grid data
;GN_AFTERUPDATE      equ 10   ;Sendt after grid data has been updated
;GN_USERCONVERT      equ 11   ;Sendt when user cell needs to be converted.
;
;;Messages GM_*
;
;GM_ADDCOL      equ WM_USER+1   ;wParam=0, lParam=lpCOLUMN
;GM_ADDROW      equ WM_USER+2   ;wParam=0, lParam=lpROWDATA (can be NULL)
;GM_INSROW      equ WM_USER+3   ;wParam=nRow, lParam=lpROWDATA (can be NULL)
;GM_DELROW      equ WM_USER+4   ;wParam=nRow, lParam=0
;GM_MOVEROW      equ WM_USER+5   ;wParam=nFromRow, lParam=nToRow
;GM_COMBOADDSTRING   equ WM_USER+6   ;wParam=nCol, lParam=lpszString
;GM_COMBOCLEAR      equ WM_USER+7   ;wParam=nCol, lParam=0
;GM_GETCURSEL      equ WM_USER+8   ;wParam=0, lParam=0
;GM_SETCURSEL      equ WM_USER+9   ;wParam=nCol, lParam=nRow
;GM_GETCURCOL      equ WM_USER+10   ;wParam=0, lParam=0
;GM_SETCURCOL      equ WM_USER+11   ;wParam=nCol, lParam=0
;GM_GETCURROW      equ WM_USER+12   ;wParam=0, lParam=0
;GM_SETCURROW      equ WM_USER+13   ;wParam=nRow, lParam=0
;GM_GETCOLCOUNT      equ WM_USER+14   ;wParam=0, lParam=0
;GM_GETROWCOUNT      equ WM_USER+15   ;wParam=0, lParam=0
;GM_GETCELLDATA      equ WM_USER+16   ;wParam=nRowCol, lParam=lpData
;GM_SETCELLDATA      equ WM_USER+17   ;wParam=nRowCol, lParam=lpData (can be NULL)
;GM_GETCELLRECT      equ WM_USER+18   ;wParam=nRowCol, lParam=lpRECT
;GM_SCROLLCELL      equ WM_USER+19   ;wParam=0, lParam=0
;GM_GETBACKCOLOR      equ WM_USER+20   ;wParam=0, lParam=0
;GM_SETBACKCOLOR      equ WM_USER+21   ;wParam=nColor, lParam=0
;GM_GETGRIDCOLOR      equ WM_USER+22   ;wParam=0, lParam=0
;GM_SETGRIDCOLOR      equ WM_USER+23   ;wParam=nColor, lParam=0
;GM_GETTEXTCOLOR      equ WM_USER+24   ;wParam=0, lParam=0
;GM_SETTEXTCOLOR      equ WM_USER+25   ;wParam=nColor, lParam=0
;GM_ENTEREDIT      equ WM_USER+26   ;wParam=nCol, lParam=nRow
;GM_ENDEDIT      equ WM_USER+27   ;wParam=nRowCol, lParam=fCancel
;GM_GETCOLWIDTH      equ WM_USER+28   ;wParam=nCol, lParam=0
;GM_SETCOLWIDTH      equ WM_USER+29   ;wParam=nCol, lParam=nWidth
;GM_GETHDRHEIGHT      equ WM_USER+30   ;wParam=0, lParam=0
;GM_SETHDRHEIGHT      equ WM_USER+31   ;wParam=0, lParam=nHeight
;GM_GETROWHEIGHT      equ WM_USER+32   ;wParam=0, lParam=0
;GM_SETROWHEIGHT      equ WM_USER+33   ;wParam=0, lParam=nHeight
;GM_RESETCONTENT      equ WM_USER+34   ;wParam=0, lParam=0
;GM_COLUMNSORT      equ WM_USER+35   ;wParam=nCol, lParam=0=Ascending, 1=Descending, 2=Invert
;GM_GETHDRTEXT      equ WM_USER+36   ;wParam=nCol, lParam=lpBuffer
;GM_SETHDRTEXT      equ WM_USER+37   ;wParam=nCol, lParam=lpszText
;GM_GETCOLFORMAT      equ WM_USER+38   ;wParam=nCol, lParam=lpBuffer
;GM_SETCOLFORMAT      equ WM_USER+39   ;wParam=nCol, lParam=lpszText
;GM_CELLCONVERT      equ WM_USER+40   ;wParam=nRowCol, lParam=lpBuffer
;GM_RESETCOLUMNS      equ WM_USER+41   ;wParam=0, lParam=0
;GM_GETROWCOLOR      equ WM_USER+42   ;wParam=nRow, lParam=lpROWCOLOR
;GM_SETROWCOLOR      equ WM_USER+43   ;wParam=nRow, lParam=lpROWCOLOR
;
;;Column alignment GA_*
;
;GA_ALIGN_LEFT      equ 0
;GA_ALIGN_CENTER      equ 1
;GA_ALIGN_RIGHT      equ 2
;
;;Column types TYPE_*
;
;TYPE_EDITTEXT      equ 0   ;String
;TYPE_EDITLONG      equ 1   ;Long
;TYPE_CHECKBOX      equ 2   ;Long
;TYPE_COMBOBOX      equ 3   ;Long
;TYPE_HOTKEY      equ 4   ;Long
;TYPE_BUTTON      equ 5   ;String
;TYPE_IMAGE      equ 6   ;Long
;TYPE_DATE      equ 7   ;Long
;TYPE_TIME      equ 8   ;Long
;TYPE_USER      equ 9   ;0=String, 1 to 512 bytes binary data
;TYPE_EDITBUTTON      equ 10   ;String
;
;;Column sorting SORT_*
;
;SORT_ASCENDING      equ 0
;SORT_DESCENDING      equ 1
;SORT_INVERT      equ 2
;
;;Window styles STYLE_*
;
;STYLE_NOSEL      equ 01h
;STYLE_NOFOCUS      equ 02h
;STYLE_HGRIDLINES   equ 04h
;STYLE_VGRIDLINES   equ 08h
;STYLE_GRIDFRAME      equ 10h
;
;ODT_GRID      equ 6
;
;.const
;
;IFDEF DLL
;   szRAGridClass   db 'RAGrid',0
;ELSE
;   szRAGridClass   db 'MyRAGrid',0
;ENDIF


Global *OldGridProc

Structure COLUMN
 colwt.l
 lpszhdrtext.l
 halign.l
 calign.l
 ctype.l
 ctextmax.l
 lpszformat.l
 himl.l
 hdrflag.l
 colxp.l
 edthwnd.l
EndStructure

Structure ROWDATA
 lpszName.s
 nID.l
EndStructure


#GM_ADDCOL = #WM_USER+1 ;wParam=0, lParam=lpCOLUMN
#GM_ADDROW = #WM_USER+2 ;wParam=0, lParam=lpROWDATA (can be NULL)
#GM_GETCURROW    = #WM_USER+12   ;wParam=0, lParam=0
#GM_SETBACKCOLOR = #WM_USER+21 ;wParam=nColor, lParam=0
#GM_SETGRIDCOLOR = #WM_USER+23 ;wParam=nColor, lParam=0
#GM_SETTEXTCOLOR = #WM_USER+25 ;wParam=nColor, lParam=0
#GM_SETHDRHEIGHT = #WM_USER+31   ;wParam=0, lParam=nHeight
#GM_SETROWHEIGHT   = #WM_USER+33   ;wParam=0, lParam=nHeight
#GM_COLUMNSORT    = #WM_USER+35   ;wParam=nCol, lParam=0=Ascending, 1=Descending, 2=Invert

#GN_HEADERCLICK   = 1   ;User clicked header

#GA_ALIGN_LEFT = 0
#GA_ALIGN_RIGHT = 2
#TYPE_EDITTEXT = 0   ;String
#TYPE_EDITLONG = 1   ;Long
#SORT_INVERT = 2

Procedure WndProc(hWnd, uMsg, wParam, lParam)
  result = #PB_ProcessPureBasicEvents
  Select uMsg
    Case #WM_NOTIFY ; Catch RaGrid notifications here? Yes ;)
      notify.s="Are we there yet?"
      *gn.GRIDNOTIFY = lParam ; now the structure members hold the necessary data
      Debug *gn\col
      If *gn\nmhdr\code=#GN_HEADERCLICK
        Debug "hclick"
        SendMessage_(hGrid, #GM_COLUMNSORT, 1, 0)
      EndIf
  EndSelect
  ProcedureReturn result
EndProcedure

Procedure GridProc(hWnd, uMsg, wParam, lParam)
  Select uMsg
    Case #WM_MOUSEMOVE
      SetWindowText_(WindowID(), "X: "+Str(lParam&$ffff)+", Y: "+Str(lParam>>16))
    Case #WM_LBUTTONDOWN
      SetWindowText_(WindowID(), "WM_LBUTTONDOWN")
    Case #WM_LBUTTONUP
      SetWindowText_(WindowID(), "WM_LBUTTONUP")
  EndSelect
  ProcedureReturn CallWindowProc_(*OldGridProc, hWnd, uMsg, wParam, lParam)
EndProcedure


If OpenWindow(0, 100, 200, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window")
  If OpenLibrary(0, "RAGrid.DLL")
    InitCommonControls_()
    hGrid = CreateWindowEx_($00000200, "RAGrid", "Grid test", $5001000D, 0, 0, 195, 260, WindowID(), 0, LibraryID(0), 0)
    If hGrid
      *OldGridProc = SetWindowLong_(hGrid, #GWL_WNDPROC, @GridProc())
      hFont = SendMessage_(WindowID(), #WM_GETFONT, 0, 0)
      SendMessage_(hGrid, #WM_SETFONT, hFont, #FALSE)
      ; Beware Delphi style Hex colour codes (not html style)
      SendMessage_(hGrid, #GM_SETBACKCOLOR, $FFFFC0, 0)
      SendMessage_(hGrid, #GM_SETGRIDCOLOR, $808080, 0)
      SendMessage_(hGrid, #GM_SETTEXTCOLOR, $800000, 0)
      SendMessage_(hGrid, #GM_SETHDRHEIGHT, 0, 24)

      col.COLUMN
      col\colwt = 130
      col\lpszhdrtext = @"Name"
      col\halign = #GA_ALIGN_LEFT
      col\calign = #GA_ALIGN_LEFT
      col\ctype = #TYPE_EDITTEXT
      col\ctextmax = 31
      col\lpszformat = 0
      col\himl = 0
      col\hdrflag = 0
      SendMessage_(hGrid, #GM_ADDCOL, 0, @col)

  ;Number column
      col\colwt = 42
      col\lpszhdrtext = @"ID"
      col\halign = #GA_ALIGN_RIGHT
      col\calign = #GA_ALIGN_RIGHT
      col\ctype = #TYPE_EDITLONG
      col\ctextmax = 11
      col\lpszformat = 0
      col\himl = 0
      col\hdrflag = 0
      SendMessage_(hGrid, #GM_ADDCOL, 0, @col)

  ;Add some rows
      Dim rdta.ROWDATA(6)
      ;Test values
      rdta(0)\lpszName="Anders"
      rdta(0)\nID=1
      rdta(1)\lpszName="Carson"
      rdta(1)\nID=3
      rdta(2)\lpszName="Balantine"
      rdta(2)\nID=2
      rdta(3)\lpszName="Novus"
      rdta(3)\nID=4
      rdta(4)\lpszName="Ordo"
      rdta(4)\nID=5
      rdta(5)\lpszName="Seclorum"
      rdta(5)\nID=6
      rdta(6)\lpszName="Zachariah"
      rdta(6)\nID=7
      For i=0 To 6
        SendMessage_(hGrid, #GM_ADDROW, 0, @rdta(i))
        SendMessage_(hGrid, #GM_SETROWHEIGHT, 0, 24)
      Next i
      ShowWindow_(hGrid, #SW_SHOW)
      SetWindowCallback(@WndProc())
      ; Will column sort work here.. yup
      ; SendMessage_(hGrid, #GM_COLUMNSORT, 1, 0)
      Repeat
        EventID.l = WaitWindowEvent()
        If EventID = #PB_Event_CloseWindow
          Quit = 1
        EndIf
      Until Quit = 1
    EndIf
    DestroyWindow_(hGrid)
  EndIf
  CloseLibrary(0)
EndIf
End

Posted: Sat Apr 16, 2005 5:09 pm
by fiver
Thanks, for the help :D - it's starting to make sense now, for me the data isn't intially sorted - it should be though because col\hdrflag = 1 from the COLUMN structure, should sort the data shouldn't it? RaGrid.Inc :

; hdrflag dd ? ;Header flags. Set to ZERO or if initially sorted set to initial sort direction

#GM_COLUMNSORT won't work, at least in WndProc:

Code: Select all

Procedure WndProc(hWnd, uMsg, wParam, lParam)
  result = #PB_ProcessPureBasicEvents
  Select uMsg
    Case #WM_NOTIFY ; Catch RaGrid notifications here? Yes ;)
      *gn.GRIDNOTIFY = lParam ; now the structure members hold the necessary data
      Debug *gn\col
      If *gn\nmhdr\code=#GN_HEADERCLICK
        Debug "hclick"
        SendMessage_(hGrid, #GM_COLUMNSORT, *gn\col, 1)
      EndIf
  EndSelect
  ProcedureReturn result
EndProcedure
But in the main code the data can be sorted by stating the column number:

Code: Select all

      ShowWindow_(hGrid, #SW_SHOW)
      SetWindowCallback(@WndProc())
      ; Column sort works here.. 
      SendMessage_(hGrid, #GM_COLUMNSORT, 1, 0)
It seems strange....

Posted: Sat Apr 16, 2005 5:56 pm
by El_Choni
We both forgot this:

Code: Select all

Global hGrid

Posted: Sat Apr 16, 2005 6:40 pm
by fiver
:D One day I'll remember things like that, I'm glad you were awake.

Posted: Sun Apr 17, 2005 7:07 pm
by fiver
I've run into trouble again trying to retrieve data from the grid, ragrid.inc shows:
;GM_GETCELLDATA equ WM_USER+16 ;wParam=nRowCol, lParam=lpData

I guess that wParam=nRowCol requires that two words as a long be passed, so using the procedure:

Code: Select all

Procedure MakeLong(low.w, high.w)
  ProcedureReturn (high * $10000) | (low & $FFFF)
EndProcedure 
I tried:

Code: Select all

ElseIf *gn\nmhdr\code=#GN_AFTEREDIT
        low.w = *gn\row
        ;Debug low
        high.w = *gn\col
        lowhigh = Makelong(low, high)
        ;Debug lowhigh
        Debug SendMessage_(hGrid, #GM_GETCELLDATA, lowhigh, *gn\lpdata)
      EndIf
Which produced some very odd results when editing cells in the grid, but nothing that seemed to have a pattern, any thoughts?

Posted: Tue Apr 19, 2005 8:25 am
by LuckyLuke
@fiver
When total columns = 4
Formula :
2*(row-1)*3 + col

e.g. row = 1 col = 1 => 1
e.g. row = 3 col = 0 => 12

Note : only tested with 4 columns !

Posted: Tue Apr 19, 2005 1:50 pm
by fiver
Hi LuckyLuke,

Still no joy! :?

How are you including the formula ?

Posted: Tue Apr 19, 2005 2:26 pm
by LuckyLuke
This is working for the above example.
Formula should be row * (total nr of cols in grid + 2) + col (I think :? )

Code: Select all

Procedure.w MergeRowCol(row.w, col.w) 
  wRet.w = (row)*(2 + 2) + col  ;First 2 is total number of cols in grid !!!
  ProcedureReturn wRet
EndProcedure 

Procedure WndProc(hWnd, uMsg, wParam, lParam) 
  result = #PB_ProcessPureBasicEvents 
  Select uMsg 
    Case #WM_NOTIFY ; Catch RaGrid notifications here? Yes ;) 
      notify.s="Are we there yet?" 
      *gn.GRIDNOTIFY = lParam ; now the structure members hold the necessary data 
      If *gn\nmhdr\code=#GN_HEADERCLICK 
        Debug "hclick" 
        SendMessage_(hGrid, #GM_COLUMNSORT, 1, 0) 
      ElseIf *gn\nmhdr\code=#GN_AFTEREDIT 
        row.w = *gn\row 
        col.w = *gn\col 
        rowcol.w = MergeRowCol(row, col) 
        SendMessage_(hGrid, #GM_GETCELLDATA, rowcol, *gn\lpdata) 
        If col = 0
          Debug PeekS(*gn\lpdata)
        ElseIf col = 1
          Debug PeekL(*gn\lpdata)
        EndIf
      EndIf        
  EndSelect 
  ProcedureReturn result 
EndProcedure 

Posted: Wed Apr 20, 2005 9:24 pm
by fiver
@ LuckyLuke
That's definitely an improvement :) and gets the data from a cell, but for me it's still the first column first row, no matter which cell I edit. Is it the same for you?

I think I may have been right about the message requiring a long variable made of two words though. I think perhaps this is a restriction of windows message/notification calls: they can only have: reference, notification, long, pointer. So to give co-ordinates to RaGrid the long must be made of 2 words.

Therefore, the only way for RaGrid to return the cell data through messaging is for the co-ordinates of the cell to be fed as a long made up from the row.word and col.word from *gn\row and *gn\col. Maybe RaGrid.dll then converts this internally into the co-ordinates.
This would explain why RaGrid has a maximum limit of 65536 rows: words run from -32768 to +32767 which gives 65536 (allowing for the 0 :wink: ) I don't know for sure though, :P all of this is at >= the limits of my knowledge! but I have fun learning :wink:.

I have found the call as used in asm (look to the middle) maybe this makes sense to someone:

Code: Select all

 .elseif eax==WM_NOTIFY
	mov esi,lParam
	mov eax,[esi].NMHDR.hwndFrom
		.if eax==hGrd
		mov eax,[esi].NMHDR.code
			.if eax==GN_HEADERCLICK
			invoke SendMessage,hGrd,GM_COLUMNSORT,[esi].GRIDNOTIFY.col,SORT_INVERT

			.elseif eax==GN_BEFOREEDIT
			mov eax,[esi].GRIDNOTIFY.col
				.if eax==1
					mov edx,[esi].GRIDNOTIFY.row
					shl edx,16
					or edx,eax
					invoke SendMessage,hGrd,GM_CELLCONVERT,edx,addr buf1
					invoke SendMessage,[esi].GRIDNOTIFY.hwnd,WM_SETTEXT,0,addr buf1
					invoke SendMessage,[esi].GRIDNOTIFY.hwnd,EM_SETSEL,0,-1
				.endif

			.elseif eax==GN_AFTEREDIT
			mov eax,[esi].GRIDNOTIFY.col
				.if eax==1
					mov edx,[esi].GRIDNOTIFY.row
					shl edx,16
					or edx,eax
					invoke SendMessage,hGrd,GM_GETCELLDATA,edx,[esi].GRIDNOTIFY.lpdata
					invoke SendMessage,[esi].GRIDNOTIFY.hwnd,WM_GETTEXT,sizeof buf1,addr buf1
					invoke DecToBin,addr buf1
						.if eax>255
							xor eax,eax
						.endif
					mov ecx,[esi].GRIDNOTIFY.lpdata
						.if ViewRoll
						mov [ecx+1],al
						.else
						mov [ecx],al
						.endif
				.endif

			.elseif eax==GN_USERCONVERT
			xor eax,eax
			mov ecx,[esi].GRIDNOTIFY.lpdata
				.if ViewRoll
					mov al,[ecx+1]
					invoke BinToDec,eax,[esi].GRIDNOTIFY.lpdata
				.else
					mov al,[ecx]
					invoke BinToDec,eax,[esi].GRIDNOTIFY.lpdata
				.endif

		.endif
.endif
Well, I shall keep trying, I want to get this working! I have convinced my boss that we don't have to have a crappy VB application for which the runtime crashes all the time!!

Posted: Sat Apr 23, 2005 7:30 pm
by javabean
Hi,

I've been playing around with the RAGrid control for quite a long time, but I have no idea how to apply the window styles (e.g. STYLE_HGRIDLINES) defined in the RAGrid.inc. How could I manage this?

Posted: Sun Oct 02, 2005 12:11 pm
by FGK
@fiver @LuckyLuke

to access the Griddata with the #GM_GETCELLDATA Message
the Position of cols und rows is calculated like this:

Code: Select all


RetValue.l = 0  ; Holds the Data (ptr for String or Value)
Pos= (row << 16) + col
SendMessage_(hGrid,#GM_GETCELLDATA,Pos,@RetValue)

 
@javabean

You invoke the RAGrid something like this:

Code: Select all

If OpenWindow(0, 500, 100, 640, 480, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window") 
  If CreateGadgetList(WindowID())
    ButtonGadget(99,0,WindowHeight()-25,100,25,"Test")
    
    If OpenLibrary(0, "RAGrid.DLL") 
      InitCommonControls_() 
      hGrid = CreateWindowEx_($00000200, "RAGrid", "Grid Test", $50310000|#STYLE_NOSEL|#STYLE_NOFOCUS|#STYLE_HGRIDLINES|#STYLE_VGRIDLINES|#STYLE_GRIDFRAME, 0, 0, WindowWidth(), WindowHeight()-25, WindowID(), 0, LibraryID(0), 0) 
      If hGrid 
        ShowWindow_(hGrid, #SW_SHOW) 
         .......
         .......
The answer comes late - hope it will still help you a little bit.

Greets

FGK[/code]