Subject | Re: [IBO] Behaviour of TIB_UpdateBar |
---|---|
Author | Salvatore Besso |
Post date | 2004-05-25T17:31:14Z |
hello Helen and all,
this is a fragment of method TIB_UpdateBar.SysStateChanged taken from
IB_UpdateBar.pas starting at line 573:
Buttons[ ubEdit ].Enabled := ForceEdit or CanEdit;
Buttons[ ubInsert ].Enabled := ForceInsert or CanInsert;
Buttons[ ubDelete ].Enabled := ForceDelete or CanDelete;
Buttons[ ubPost ].Enabled := NeedToPost or ( State = dssSearch );
Buttons[ ubCancel ].Enabled := NeedToPost or ( State = dssSearch );
Making some debugging I have noticed that when I arrive at the first
line of this fragment, ForceEdit is False and CanEdit is True, hence
the edit button is Enabled. But I cannot understand the logic of using
the dataset's CanEdit property to establish the state of the edit
button. If the dataset is editable, it is obvious that CanEdit is
always True and therefore the edit button will always be enabled,
whatever the state of the dataset is (unless there is something else
hidden deeply into IBO source, but I've not made too much source
mining :-).
And the same applies to CanInsert and CanDelete used for the other two
buttons. Doing so, these buttons will always stay enabled even if the
dataset changes its state and goes into insert or edit (or delete)
mode.
Instead NeedToPost seems more logic to me, because the Post and Cancel
buttons must be enabled if there is the need to post (or cancel)
something. And in fact the enable logic of these two buttons is
correct.
If we really want Insert/Edit/Delete buttons always enabled, there are
other ways in TIB_UpdateBar object:
{: This property is to make the Insert button always enabled even if
the dataset's CanInsert property returns false.}
property ForceInsert: boolean ...
{: This property is to make the Delete button always enabled even if
the dataset's CanDelete property returns false.}
property ForceDelete: boolean ...
{: This property is to make the Edit button always enabled even if the
dataset's CanEdit property returns false.}
property ForceEdit: boolean ...
Anyway it seems obvious, reading the above enabling code, that the
state of the three buttons doesn't really depend from the associate
dataset's state, but depends from something else.
Regards
Salvatore
this is a fragment of method TIB_UpdateBar.SysStateChanged taken from
IB_UpdateBar.pas starting at line 573:
Buttons[ ubEdit ].Enabled := ForceEdit or CanEdit;
Buttons[ ubInsert ].Enabled := ForceInsert or CanInsert;
Buttons[ ubDelete ].Enabled := ForceDelete or CanDelete;
Buttons[ ubPost ].Enabled := NeedToPost or ( State = dssSearch );
Buttons[ ubCancel ].Enabled := NeedToPost or ( State = dssSearch );
Making some debugging I have noticed that when I arrive at the first
line of this fragment, ForceEdit is False and CanEdit is True, hence
the edit button is Enabled. But I cannot understand the logic of using
the dataset's CanEdit property to establish the state of the edit
button. If the dataset is editable, it is obvious that CanEdit is
always True and therefore the edit button will always be enabled,
whatever the state of the dataset is (unless there is something else
hidden deeply into IBO source, but I've not made too much source
mining :-).
And the same applies to CanInsert and CanDelete used for the other two
buttons. Doing so, these buttons will always stay enabled even if the
dataset changes its state and goes into insert or edit (or delete)
mode.
Instead NeedToPost seems more logic to me, because the Post and Cancel
buttons must be enabled if there is the need to post (or cancel)
something. And in fact the enable logic of these two buttons is
correct.
If we really want Insert/Edit/Delete buttons always enabled, there are
other ways in TIB_UpdateBar object:
{: This property is to make the Insert button always enabled even if
the dataset's CanInsert property returns false.}
property ForceInsert: boolean ...
{: This property is to make the Delete button always enabled even if
the dataset's CanDelete property returns false.}
property ForceDelete: boolean ...
{: This property is to make the Edit button always enabled even if the
dataset's CanEdit property returns false.}
property ForceEdit: boolean ...
Anyway it seems obvious, reading the above enabling code, that the
state of the three buttons doesn't really depend from the associate
dataset's state, but depends from something else.
Regards
Salvatore