EhLib.Com
https://forum.ehlib.com/en/

Column focus with checkbox
https://forum.ehlib.com/en/viewtopic.php?f=5&t=852
Page 1 of 1

Author:  jsm [ 18 Sep 2018, 18:37 ]
Post subject:  Column focus with checkbox

Hi, I select column with checkbox active, but keyboard not work(space key),
first must select cell with mouse then can change checkbox state with keyboard
I use SelectedIndex for select column

Author:  EhLibSupport [ 20 Sep 2018, 07:43 ]
Post subject:  Re: Column focus with checkbox

Hello

You can write TDBGridEh.OnKeyPress event like this

Code:
procedure TForm1.DBGridEh1KeyPress(Sender: TObject; var Key: Char);
begin
  DBGridEh1.SelectedRows.CurrentRowSelected := not DBGridEh1.SelectedRows.CurrentRowSelected;
end;


May be also remove dghClearSelection from OptionsEh

Author:  jsm [ 25 Sep 2018, 08:07 ]
Post subject:  Re: Column focus with checkbox

your code not work & Not relevant to my question.
after change field(column) with SelectedIndex to boolean field(checkbox), selected field changed but focus not change(Caret cursor) & must click with mouse, then you can change with keyboard checkbox state(with space key)

Author:  EhLibSupport [ 26 Sep 2018, 01:21 ]
Post subject:  Re: Column focus with checkbox

Hello

Do you put focus on the grid

Code:
  DBGridEh1.SelectedIndex := 5;
  DBGridEh1.SetFocus;

Author:  jsm [ 26 Sep 2018, 04:28 ]
Post subject:  Re: Column focus with checkbox

No, Grid Has focused,
my question is about column, i change selected column by "SelectedIndex ", but about column with checkbox capability, Real focus not change from one column to this column,
you should click by mouse then you can change checkbox state(in column) with keyboard(space key)

Attachments:
Sample.png
Sample.png [ 793 Bytes | Viewed 1460 times ]

Author:  EhLibSupport [ 26 Sep 2018, 11:53 ]
Post subject:  Re: Column focus with checkbox

Hello

We can't reproduce the problem.
Could you send your dfm+pas file here or to the support@ehlib.com.
Or can you reproduce the problem in one of standard EhLib Demos.

Author:  jsm [ 26 Sep 2018, 13:12 ]
Post subject:  Re: Column focus with checkbox

Hi,
Yes,
In MainDemo--->FrameMainGrid:
plz change in OptionsEh: remove dghRowHighlight & Select dghEnterAsTab
Now, move on column by enter, after select "Preferred", try checked checkbox by keyboard(space key)
you can not change state key, until click by mouse on this column, After this you can change checkbox state by keyboard(space key)

Author:  EhLibSupport [ 01 Oct 2018, 21:17 ]
Post subject:  Re: Column focus with checkbox

Hello

MainDemo--->FrameMainGrid is not a good example because the Grid have dghPreferIncSearch in OptionsEh.
It try to search char that you press on the keyboard rather than perform Edit operation (Lake open Editor or change CheckBox state).
Then you click on checkbox by mouse you put Grid into edit mode. IncSearch is disabled in Edit mode.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/