Hi mnemox

If I can find the time.

KetilO
Posted on 2003-11-21 04:18:23 by KetilO
Hi all

New upload at the top.

Whats new:
- Created RAGrid.lib and a demo showing how to use the library in your project.

KetilO
Posted on 2003-11-21 04:20:11 by KetilO
Thanks KetilO. I have now set up 3 of your controls (RAEdit, RAGrid, RAHexEd) working in my emulator project just fine, which makes my program look so slick! The teachers in our college praised for my program (and for your controls as well ^_^). My program is being used in our MCU lab now. Thanks again and keep on good working!

And web site of my project:
http://member.netease.com/~huangyc/chip/
Posted on 2003-11-21 09:45:25 by optimus
Hi optimus

Nice to hear that your hard work turned into something useful.

KetilO
Posted on 2003-11-21 13:07:40 by KetilO
Cool, Kjetil! ;) Good work, once again... One question: are you going to make a "lib-version" of RAEdit, RAHexEd (and maybe the resource editor) too??

Regards,
Tommy
Posted on 2003-11-21 13:25:05 by Tommy
Hi all , Im here another time , I have this code but when edit a cell
the first time the title bar is empty , and the next times workin fine
the title bar get the text from the cell without problems, only the first
time the buffer is empty... why?



.elseif eax==GN_AFTEREDIT

invoke SendMessage, hGrd, GM_GETCURSEL, 0, 0
mov edx,eax
invoke SendMessage, hGrd, GM_GETCELLDATA, edx, addr szBuffCellData

invoke SetWindowText, hWnd, addr szBuffCellData



Thanks for all.
Posted on 2003-11-22 15:55:43 by mnemox
Hi mnemox

Have a look at the comments for each notification message.



GN_BEFOREEDIT ;Sendt before the cell edit control shows
GN_AFTEREDIT ;Sendt when the cell edit control is about to close
GN_BEFOREUPDATE ;Sendt before a cell updates grid data
GN_AFTERUPDATE ;Sendt after grid data has been updated


In your example the grid data is not updated yet. Using GN_AFTERUPDATE should solve the problem.

KetilO
Posted on 2003-11-22 17:08:10 by KetilO
Great work, Ketil.
Are you going to implement column width autosize?
I mean feature that exist in "usual" sheets - dblclk when
mouse between two columns heads make the column autosize to fit width of max length string in the column.
Posted on 2003-11-22 17:53:51 by The Svin
OK, its true , im sorry.

Thanks for your help one more time.
Posted on 2003-11-22 17:58:10 by mnemox
There are altogether 8 RAGrids in my app now! :)

Posted on 2003-11-24 02:38:01 by optimus
And I wonder if there is an easy way to compile RAEdit, RAGrid, RAHexEd into one single DLL?
Posted on 2003-11-24 02:39:19 by optimus
Hi optimus

Nice looking app.
Only old fashion hard work lets you create one dll from three dll's.

KetilO
Posted on 2003-11-24 05:01:54 by KetilO
What about compiling the controls to *.lib?
Posted on 2003-11-24 08:47:35 by Tommy
Is it possible to make 3 dlls into 3 lib, and another project to adopt these 3 libs and compile into one dll?
Posted on 2003-11-24 20:42:39 by optimus
Hi Tommy & optimus

Creating a library of the dll's does not solve any problems. You still have to rewrite to handle resources.

KetilO
Posted on 2003-11-25 02:44:07 by KetilO
Hi Kjetil... I didn't mean that either... I just wondered if you could make library versions of your controls (like you did with the grid) or something... COFF maybe, so that all the controls can be compile within the executable to be written. You see?
Posted on 2003-11-25 05:15:35 by Tommy
Hello again , how can I capture in griddemo the ins and supr keys ?

I want add a new row by push the ins key and delete a row by push supr key.

thanks in advance for all. :alright:
Posted on 2004-01-09 16:09:52 by mnemox
I'm coding up a small utility using your grid control, and I've run into an annoying problem. I'm not sure what I'm doing wrong, so I kinda hoped you could spot the problem.

So far, the program is basically a grid control in a dialogbox. The grid has two columns, column 0 is text, column 1 is a custom column. Basically what I'm trying to do is store two one-byte values in the data for this column, and switch between displaying one value or the other based on a flag in my program. Sorry for abusing your control in this way, but having two grid controls seemed like bloat for something so simple. :)

The problem is that entering a value in one column sometimes seems to change the value for the other column as well. For example, I enter a space in the text column, and the user column displays "32". Also when I enter "32" in the user column, the first character of the text column changes to a space. What makes it really strange is that these seem to link and unlink at random.

This is the code I use to initialize the user column (almost 100% copied from your code):



mov col.colwt,50
mov col.lpszhdrtext,CTEXT("Init")
mov col.halign,GA_ALIGN_LEFT
mov col.calign,GA_ALIGN_RIGHT
mov col.ctype,TYPE_USER
mov col.ctextmax,2
mov col.lpszformat,0
mov col.himl,0
mov col.hdrflag,0
invoke CreateWindowEx,0,CTEXT("Edit"),NULL,WS_CHILD or WS_BORDER or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or ES_AUTOHSCROLL or ES_RIGHT,0,0,0,0,hWnd,NULL,hInstance,0
mov col.edthwnd,eax
invoke SetWindowLong,eax,GWL_WNDPROC,offset EdtLongProc
invoke SetWindowLong,col.edthwnd,GWL_USERDATA,eax
invoke SendMessage,col.edthwnd,EM_LIMITTEXT,3,0
invoke SendMessage,hGrd,GM_ADDCOL,0,addr col


This is the code I have in my WndProc for handling the grid notifications:



.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
Posted on 2004-01-18 13:43:33 by Qweerdy
Ketil, dunno if the control already has this option, but what about supporting excel-style keyboard navigation? You know, allow arrow keys to change to another cell even when editing data? (Should of course be configurable if you want it enabled or not)
Posted on 2004-01-18 14:36:16 by f0dder
I think your code here is wrong

.elseif eax==GN_AFTEREDIT
mov eax,.GRIDNOTIFY.col ;this dont work to me
.if eax==1
mov edx,.GRIDNOTIFY.row
shl edx,16



I try it and dont work in GN_AFTERUPDATE, you must try this:

.elseif eax==GN_AFTEREDIT
invoke SendMessage, hGrd, GM_GETCURCOL, 0, 0 ;this work fine
.if eax==1
mov edx,.GRIDNOTIFY.row
shl edx,16
Posted on 2004-01-21 15:25:09 by mnemox