loading the control isn't a problem. but there are many structs and constants to deal with. i think the one who made RAEdit must be the one who can write out a demo most quickly.

ps: Ketilo does code in VB. He ever wrote a good VB demo of RAEdit which help me a lot. And VB is just sth good. I program with VB and win32 asm together to do most of the jobs. In that way, both efficiency and performance can be guranteed.

Check out my web site:
That's my project using RAEdit. (can't see RAEdit in screenshot yet)
Posted on 2003-11-09 20:37:46 by optimus
Hi optimus

Among other things I code in VB for a living.

Here is a VB demo.

Posted on 2003-11-11 06:41:12 by KetilO
Thanks a lot, KetilO!!!
Posted on 2003-11-11 23:23:20 by optimus
Hi KetilO. How to set the height of a cell, or can it be set?
And how to know if a certain cell has just been modified?
Posted on 2003-11-12 02:51:28 by optimus
Check out: RaGrid.inc
Try out these messages and notifications!

Hi KetilO. How to set the height of a cell, or can it be set?

GM_GETROWHEIGHT equ WM_USER+32 ;wParam=0, lParam=0
GM_SETROWHEIGHT equ WM_USER+33 ;wParam=0, lParam=nHeight

And how to know if a certain cell has just been modified?

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
Posted on 2003-11-12 03:16:02 by farrier
thanks. but i am using RAGrid in vb. Is it any callback method for notification in RAGrid?
Posted on 2003-11-12 04:09:19 by optimus
OK, I managed to make a hook proc in vb app to receive the notification from RAGrid. But also found a problem. When receiving GN_AFTERUPDATE, the GRIDNOTIFY.col is the correct column number (it is always 1188).
Posted on 2003-11-12 08:14:45 by optimus
Hi optimus

Thanks for the bug report. New upload at the top.

Can you post the code for the hook proc?

Posted on 2003-11-13 01:19:29 by KetilO
This is my code to receive notification messages from RAGrid. To avoid the bug I mentioned, I placed two module-wide variables, EditingCol and EditingRow.

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal HWND As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, ByVal HWND As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const GWL_WNDPROC = (-4)
Private Const WM_NOTIFY = &H4E
Private PrevFuncPointer As Long, EditingCol As Integer, EditingRow As Integer

Private Type NMHDR_TYPE
hwndFrom As Long
idFrom As Long
code As Long
End Type

col As Long
row As Long
HWND As Long
lpdata As Long
fcancel As Long
End Type

Public GNotify As GRIDNOTIFY

Public Function WndProc(ByVal HWND As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_NOTIFY Then
If Not Busy Then
CopyMemory ByVal VarPtr(GNotify), ByVal lParam, Len(GNotify)
Select Case GNotify.NMHDR.code
EditingCol = GNotify.col
EditingRow = GNotify.row
If EditingCol = 0 Then 'Disable modifying column 0
GNotify.fcancel = 1
CopyMemory ByVal lParam, ByVal VarPtr(GNotify), Len(GNotify)
End If
Exit Function
Select Case GNotify.NMHDR.hwndFrom
Case RAGrid.hGrid
SetRegValue GNotify.lpdata
Case SFRGrid.hGrid
SetSFRValue GNotify.lpdata
End Select
Exit Function
End Select
End If
End If
'Pass the procedure to the default handler
WndProc = CallWindowProc(PrevFuncPointer, HWND, Msg, wParam, lParam)
End Function

Sub SetMsgHook(HWND As Long)
PrevFuncPointer = SetWindowLong(HWND, GWL_WNDPROC, AddressOf WndProc)
End Sub

Sub RemoveMsgHook(HWND As Long)
If PrevFuncPointer <> 0 Then
SetWindowLong HWND, GWL_WNDPROC, PrevFuncPointer
End If
End Sub

I've made the code related with RAGrid a class (RAGrid_Class), mainly based on your vb demo code and expanded a little. The attached file is the class file.
Posted on 2003-11-13 03:45:22 by optimus
Hi KetilO. Does RAGrid support check box in cell? If not, can u one day implement this?
Posted on 2003-11-13 07:23:52 by optimus
Hi Optimus

There is the TYPE_CHECKBOX column. For weird things use TYPE_USER column.

Posted on 2003-11-13 09:06:45 by KetilO
I noticed that checkbox in RAGrid is checked by a double-click. can it be changed to a single-click?
Posted on 2003-11-13 21:05:56 by optimus
I've got several questions.
How to make one column un-editable?
How to make the column name row invisible?
Does RAGrid support full-row-selection, just like a list view control?
And also find function maybe? I think it's useful.
Posted on 2003-11-14 09:25:59 by optimus
Hi Optimus

1. How to make one column un-editable?
2. How to make the column name row invisible?
3. Does RAGrid support full-row-selection, just like a list view control?
4. And also find function maybe? I think it's useful.

1. Cencel the GN_BEFOREEDIT notification.
2. Use GM_SETHDRHEIGHT with height = 0
3. Have a look at STYLE_XX's
4. On my todo list.

Posted on 2003-11-14 14:13:39 by KetilO
Is it possible to set fixed column width (can't be sized by user)?
And will RAGrid support hex type?

btw: I found another small bug. When RAGrid lost focus, the selection box doesn't disappear. (I think it should)
Posted on 2003-11-14 21:24:03 by optimus
wish HexEd comes with a vb demo too
Posted on 2003-11-15 10:12:18 by optimus
Hello all.

I want show the current system date in a TYPE_DATE cell
but if I am not wrong is needed convert date to dword format

is true? I am looking for code for convert date to dword and
dword to date formats or there is another better way... ???

Is this the way?


; time is a SYSTEMTIME struct
; rdta is a ROWDATA struct


.elseif eax==IDC_BTNADD

invoke GetLocalTime, addr time ; Get current date and time

;..... ; code for date to dword convert

mov eax, code
mov rdta.lpDate, eax

invoke SendMessage, hGrd, GM_ADDROW, 0, addr rdta
invoke SendMessage,hGrd,GM_SETCURSEL,0,eax
invoke SetFocus,hGrd


Thanks and I am sorry for mi english, regards from Barcelona.. . :cool:
Posted on 2003-11-15 15:07:14 by mnemox
Hi mnemox

Converting dword to system time:

;Days since 01.01.1601
mov eax,val
;Convert to number of 100 nano seconds since 01.01.1601
mov ecx,24*60*60
mul ecx
push edx
mov ecx,1000*1000*10
mul ecx
mov ftime.dwLowDateTime,eax
pop eax
push edx
mul ecx
pop edx
add eax,edx
mov ftime.dwHighDateTime,eax
invoke FileTimeToSystemTime,addr ftime,addr stime

Converting system time to dword:

invoke SystemTimeToFileTime,addr stime,addr ftime
;Convert to days since 01.01.1601
mov ecx,10*1000*1000
mov eax,ftime.dwHighDateTime
xor edx,edx
div ecx
mov ftime.dwHighDateTime,eax
mov eax,ftime.dwLowDateTime
div ecx
mov ftime.dwLowDateTime,eax
mov ecx,24*60*60
mov edx,ftime.dwHighDateTime
mov eax,ftime.dwLowDateTime
div ecx
mov val,eax

Posted on 2003-11-15 15:55:26 by KetilO
Thanks , KetilO , I am going to try it.
Posted on 2003-11-15 16:14:35 by mnemox
ok, is working fine but is posible some code for modify the data base?
add rows , insert o delete rows or modify the data in cell?

Thanks for all.
Posted on 2003-11-20 16:05:37 by mnemox