grid dblclick
Moderator: Rathinagiri
grid dblclick
I am having trouble in grid with dblclick. My column 2 of grid is qty, which it must update a different table if changed so it must be locked.
I am trying to not allow double click on column 2.
I use on enter to make changes in the grid and in col 2 I must be able to lock the other file/record before allowing change. dblclick makes a mess in this case.
In the grid
on dblclick { if grid.value[2] = 2 no not allow double click ?
Thanks in advance..
I am trying to not allow double click on column 2.
I use on enter to make changes in the grid and in col 2 I must be able to lock the other file/record before allowing change. dblclick makes a mess in this case.
In the grid
on dblclick { if grid.value[2] = 2 no not allow double click ?
Thanks in advance..
All The Best,
Franco
Canada
Franco
Canada
Re: grid dblclick
You should use WHEN codeblock table, which controls which column is editable
Re: grid dblclick
Thanks Mol
I use WHEN but only with .T. or .F.
I see you can put code in the WHEN for a column, I did not know before.
Now I need to figure how to put code to see if I get a Lock then col 2 is .T. and after change it is .F.
I use WHEN but only with .T. or .F.
I see you can put code in the WHEN for a column, I did not know before.
Now I need to figure how to put code to see if I get a Lock then col 2 is .T. and after change it is .F.
All The Best,
Franco
Canada
Franco
Canada
Re: grid dblclick
You can use something like this:
Or, you can put any action required before cell edition.
After that, you can use VALID codeblocks determining if everything is good
Code: Select all
function GridWhenTest
return This.CellColIndex == 2
After that, you can use VALID codeblocks determining if everything is good
Re: grid dblclick
how can I find lastcharacterpressed() I cannot find driving me nuts
if get last = chr(13)
return .T.
else
return .F.
endif
if get last = chr(13)
return .T.
else
return .F.
endif
All The Best,
Franco
Canada
Franco
Canada
- Claudio Ricardo
- Posts: 367
- Joined: Tue Oct 27, 2020 3:38 am
- DBs Used: DBF, MySQL, MariaDB
- Location: Bs. As. - Argentina
Re: grid dblclick
Hi... In Cli**er and Harbour have LastKey () Example:
If LastKey () = 13
Return .T.
Else
Return .F.
EndIf
Another (This can be used in code block):
Function EnterKeyPress // or other name
Return Iif ( LastKey () = 13 , .T. , .F. )
If LastKey () = 13
Return .T.
Else
Return .F.
EndIf
Another (This can be used in code block):
Function EnterKeyPress // or other name
Return Iif ( LastKey () = 13 , .T. , .F. )
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
WhatsApp / Telegram: +54 911-63016162
Re: grid dblclick
try to use piece of this code:
Code: Select all
ch := HMG_GetLastCharacter(@hWnd)
IF hWnd == GetControlHandle ("GridControlName","FormName")
return if(asc(ch) == 13, .T., .F.)
ENDIF
- AUGE_OHR
- Posts: 2062
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: grid dblclick
hi,
if you "press" a Key than use HMG_GetLastVirtualKeyDown()
if you "press" a Key than use HMG_GetLastVirtualKeyDown()
Code: Select all
LOCAL xKey := HMG_GetLastVirtualKeyDown()
DO CASE
CASE xKey == VK_RETURN
have fun
Jimmy
Jimmy
Re: grid dblclick
Thanks guys for all your help. I came up with 2 ways to make it work from your suggestions.
I only want to use ENTER key to change column 2 in grid.
In grid definition.
1:
2:
I only want to use ENTER key to change column 2 in grid.
In grid definition.
1:
Code: Select all
COLUMNWHEN { {||.T.}, {|| iIf(HMG_GetLastVirtualKeyDown() == 13, .T., .F.)}, {||.T.}, {||.T.}, {||.T.}, {||.T.}}
Code: Select all
COLUMNWHEN { {||.T.}, {|| CHECK()}, {||.T.}, {||.T.}, {||.T.}, {||.T.}}
FUNCTION CHECK
Local aCell, ch := HMG_GetLastVirtualKeyDown()
HMG_CleanLastVirtualKeyDown()
aCell := form_1.Grid_1.value
If ch == 13 .and. aCell[2] = 2
aCell[2] := 3
form_1.Grid_1.value := aCell
Return .T.
Else
form_1.Grid_1.value := aCell
Return .F.
Endif
RETURN
All The Best,
Franco
Canada
Franco
Canada
Re: grid dblclick
I am trying to find something that must be simple. I need not the value of grid but what the cell value is before save.
When linked to a table the before the save the cell value can be different from table. I AM HAVING TROUBLE FINDING THAT VALUE.
Also on change procedure always fires at least twice because when you enter cell it has change then you modify cell it has change.
I have created a public variable that in the change procedure I make the first change return to grid then process the second change.
When linked to a table the before the save the cell value can be different from table. I AM HAVING TROUBLE FINDING THAT VALUE.
Also on change procedure always fires at least twice because when you enter cell it has change then you modify cell it has change.
I have created a public variable that in the change procedure I make the first change return to grid then process the second change.
All The Best,
Franco
Canada
Franco
Canada