Subject Application-wide Shortcut-Keys for DataSource.post- cancel- Operations
Author Andreas Filsinger
Hi IBO-Family,

BACKGROUND:
===========

my Application has about 40 IB_Grids on 25 Forms connected to many
many IB_DataSources. I use IB_UpdateBars to navigate through the data
and do the "post". Because i use the colour-sheme on grids and edits,
users love to press the yellow "post" button to "save" the data (for
years now). But today they want to press a Funktion-Key to "post", in
my case <F9>. Experienced users do not want to use the mouse any
more :-(. I want to assign the F9-Key to the "post" Button of the
update-Bar (And had a little success).

* I learned, that i can use a TActionList and insert "Build In"
Actions to this List (IB_ActionPost for ex.).
* I set the "shortcut" to F9
* I set the "DataSource"-Property to the same Source my Grid and my
UpdateBar is linked to
* I set "enabled" to true.

-> This works! But only with one Grid on this form. :-0

* On a form with 2 Grids (and 2 DataSources), i used the "focus
changes" event to detect which DataSource is the active one. For this
i used the event OnGainFocus of the grid.

procedure TFormBelege.setShortCut(pDataSource: TIB_DataSource);
var
n : integer;
begin
for n := 0 to pred(ActionListIB.ActionCount) do
with ActionListIB.Actions[n] as TIB_CustomActionUpdate do
DataSource := pDataSource;
end;

procedure TFormBelege.IB_Grid1CellGainFocus(Sender: TObject; ACol,
ARow: Integer);
begin
setShortCut(IB_DataSource1);
end;

procedure TFormBelege.IB_Grid2CellGainFocus(Sender: TObject; ACol,
ARow: Integer);
begin
setShortCut(IB_DataSource2);
end;

* Its not perfect because i want to detect the focused DataSource,
and not focus changes on "single cell level" where DataSource stays
unchanged - but it works.
* Now, my single form worked i tried now to use the TActionList of
one form in another form, by filling the TAction.DataSource Property
with the DataSource of another form, that didn't work because it
seems that unfocused Forms do not listen on ShortCuts Keys of their
action list. If the Focus changes to another form it seems that
TActionList ShortCuts are totaly disabled.

QUESTION:
=========

* Is it true that i MUST use a TActionList on all of my 25 Forms? Is
there a better way to do it?
* Is it possible to define "application-wide" shortcut for
IB_ActionPost?

Thanks for any comments!

Andreas
http://orgamon.org/