Subject | Re: [IBO] Problem with IB_LocateEditEnh |
---|---|
Author | Jason Wharton |
Post date | 2001-01-21T08:45:54Z |
I am presuming you resolved this in that update you sent?
If not, let me know.
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
If not, let me know.
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
----- Original Message -----
From: "Geoff Worboys" <geoff@...>
To: <IBObjects@egroups.com>
Sent: Saturday, January 13, 2001 9:16 PM
Subject: Re: [IBO] Problem with IB_LocateEditEnh
> > Go for it Geoff. Sounds like some worthy enhancements. As I
> > recall now, someone did make those changes and sent them to me.
>
> Jason,
>
> I have a small problem. I setup a property on the LocateEdit called
> "DisableEditing". I wanted to use this to prevent the user from
> trying to change the contents of the locate edit while in one of the
> edit modes.
>
> I started by looking at what you had in IBC_CustomEdit.IMP - where you
> change the control ReadOnly status in the EditingChanged handler. So
> I setup the following in LocateEdit...
>
> procedure TIB_LocateEdit.EditingChanged( Sender: TIB_DataLink;
> IB_DataSource:
> TIB_DataSource );
> begin
> if (DataLink.State in [dssInsert,dssEdit,dssSearch]) then begin
> if DisableEditing then
> inherited ReadOnly := true
> else inherited EditingChanged( Sender, IB_DataSource );
> end;
> end;
>
>
> This did not have the desired effect, a user could still type
> characters into the control.
>
> I did come up with a fix, but I need you to verify that this should be
> safe. In IBC_Edit.IMP I looked for calls to EditCanModify in the key
> stroke handlers.
>
> From KeyDown I setup as...
>
> end else begin
> inherited KeyDown( Key, Shift );
> if ( Key = VK_DELETE ) or
> (( Key = VK_INSERT ) and ( ssShift in Shift )) then begin
> if not EditCanModify then
> Key := 0; // prevent the change <<< === See this
>
>
> From KeyPress I setup as...
>
> case Key of
> ^H, ^V, ^X, #32..#255: begin
> if EditCanModify then begin
> if ( Length( Text ) = 0 ) and
> ( Field <> nil) and
> ( FieldCharCase = ccProper ) then begin
> Key := AnsiUpperCase( Key )[1];
> end;
> end else Key := #0; // dont allow change <<< === See this
> end;
>
>
> All I am doing in each case is preventing further processing of the
> key by setting it to zero when EditCanModify returns false. AFAICT
> this **should** always be safe, however since TIB_Edit is such a
> central control I thought I should ask your opinion.
>
> Note: I would have sent you the entire unit, but it also contains
> AutoLabel changes at this stage.
>
>
> TIA
>
> Geoff Worboys
> Telesis Computing
>
>
>
>