Page 4 of 6
Posted: Thu Aug 02, 2007 8:13 pm
by Amnesty
srod wrote:
Do you mean that instead of a double click to edit a cell we use a siingle click? Or do you mean that when a cell is first edited, rather than place the caret at the end of the text, we select the whole text? Either is simple to add.
Sorry for my bad describing. YES I m speaking about your last scenario. When you click the cell, the whole text is selected. Thats great, because I can start to edit without moving cursor.
Posted: Thu Aug 02, 2007 9:17 pm
by srod
Simply comment out (or remove completely) the line :
Code: Select all
SendMessage_(hWnd, #EM_SETSEL, -1,0)
in the _LIEeditProc() procedure.

Numeric only cell
Posted: Sun Aug 26, 2007 7:05 pm
by RichardL
Hi,
Thanks for this very useful utility, I have to finish a demo program this week and your utility has just cut 25% off the job... great. I have added code to limit which columns can be eddited (as per your comments) All I need now is to restrict some columns to numeric only. Can you give me a hint please.
Best regards,
RichardL
PS: Why does the sun come out when I need an excuse to write code?
Re: Numeric only cell
Posted: Sun Aug 26, 2007 7:58 pm
by srod
RichardL wrote:All I need now is to restrict some columns to numeric only. Can you give me a hint please.
Best regards,
RichardL
PS: Why does the sun come out when I need an excuse to write code?
Just add a #WM_CHAR handler to the _LIEeditProc() procedure. E.g. the following will only allow the user to enter numeric characters in column 1 (any character in other columns) :
Code: Select all
Case #WM_CHAR
;For cells in column 1, only allow numeric characters.
If *liedit\subitem <> 1 Or (wParam>=48 And wParam<=57)
result=CallWindowProc_(oldwinproc, hWnd, uMsg, wParam, lParam)
EndIf
Posted: Mon Aug 27, 2007 8:14 am
by RichardL
Good morning.
Thanks a lot, thats perfect.
Richard
Posted: Mon Aug 27, 2007 11:53 am
by srod
You're welcome Richard.
Posted: Mon Aug 27, 2007 12:54 pm
by klaver
srod wrote:
Just add a #WM_CHAR handler to the _LIEeditProc() procedure. E.g. the following will only allow the user to enter numeric characters in column 1 (any character in other columns) :
Code: Select all
Case #WM_CHAR
;For cells in column 1, only allow numeric characters.
If *liedit\subitem <> 1 Or (wParam>=48 And wParam<=57)
result=CallWindowProc_(oldwinproc, hWnd, uMsg, wParam, lParam)
EndIf
Hmm, it's impossible to use a backspace key in such cell

Posted: Mon Aug 27, 2007 1:13 pm
by srod
klaver wrote:Hmm, it's impossible to use a backspace key in such cell

Nothing's impossible :
Code: Select all
Case #WM_CHAR
;For cells in column 1, only allow numeric characters.
If *liedit\subitem <> 1 Or (wParam>=48 And wParam<=57) Or wParam=8
result=CallWindowProc_(oldwinproc, hWnd, uMsg, wParam, lParam)
EndIf

Posted: Thu Aug 30, 2007 6:24 pm
by aaron
Just used this in my code. Thanks! I was scratching my head trying to figure out how to edit a single cell in the listicon gadget and then decided to check the forums. Huge timesaver!

Posted: Thu Aug 30, 2007 10:19 pm
by srod
You're welcome aaron.
Posted: Tue Jul 08, 2008 1:26 pm
by srod
Update: 08/07/08. Vista compatible.
Getting this to run on Vista required a couple of dirty hacks as we are doing something here which Windows (especially Vista) is set up to prevent!

In fact, earlier version of Windows are also set up to prevent us moving the edit control reserved for editing labels (column 0) in order to edit other cells - it's just that the prevention fails! Not on Vista (with XP themes enabled) however!
I'll not bore you with the details of the evil hacks - suffice to say that I have tested on XP and Vista and everything seems okay. I am suspicious that the edit control alignment will be out on Win Server 2003, but this is easily fixed if it proves to be the case.
Code is in the first post.
Posted: Wed Jul 23, 2008 4:30 pm
by Pureabc
Very nice, thank you.
Is it possible to highlight only one cell when it is clicked once?
Posted: Wed Jul 23, 2008 4:57 pm
by srod
Thanks.
Do you mean you wish to edit the cell when clicked once or you want the cell highlighted or the cell in the first column highlighted?

Posted: Wed Jul 23, 2008 5:12 pm
by Pureabc
Double-click to edit.
Single click to highlight the cell. (the cell highlighted, not edit the cell)
Thank you.
Posted: Wed Jul 23, 2008 5:24 pm
by srod
Well, the thing is that the original column zero has been blanked out because it is somewhat badly behaved when attempting to edit cells. The first column you see in the example is in fact column 1. Thus if you want to highlight a cell in response to a selection then you will have to add that code yourself. This is not necessarily as easy as it sounds, however, depending on how you approach this.
What is easier is to simply apply the #PB_ListIcon_FullRowSelect flag to the listicon. This will of course result in the entire row being highlighted.