Subject Re: [IBO] Application-wide Shortcut-Keys for DataSource.post- cancel- Operations
Author Ramil
Hello Andreas,

In my case I just make one CommonDataEditForm in which I allocated all
related components: ActionList, PopupMenus, Navigators and other
dialog buttons and panels. It also contain common functions and
procedures like your setShortCut. Including FormCreate, FormShow,
FormClose or FormCloseQuery, FormActivate and many custom methods.

And all other forms is inherited from this CommonDataEditForm.
Actually I have longer hereditary chain. For example:
CommonDataSetForm - CommonEditForm - CommonRef - SomeCustomForm.

Each form extend or override the controls and methods of its ancestor.
And I can choose appropriate ancestor for any of my forms.
For example:
CommonDataSetForm - CommonEditForm - SomeCustomForm2.

It's really convenient for me. Moreover it comply with the
object-oriented programming paradigm.


Best regards,
Ramil R. Khabibullin khabibr@...


Thursday, January 18, 2007, 3:27:25 PM, you wrote:

>
>
>
>
>
> 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/
>
>