Jump to content


Photo

Text Column with InplaceEdit allows input into the InplaceEdit even when the edit is set to read only.


  • Please log in to reply
4 replies to this topic

#1 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 27 June 2019 - 11:29 PM

If you use the arrow key to enter a cell, then dismiss the inplace edit by pressing escape. Then type a letter on the keyboard when the edit is shown, it has the key pressed typed into the edit control.

 

Here's an example. 

 

https://i.imgur.com/uSnDXbh.gif 

 

procedure TFormCheckListDlg.CompletedItemsInplaceEditInsert(Sender: TObject;
  ACol, ARow: Integer; Component: TComponent);
begin
  inherited;
  if (ACol = 2) then
  begin
    Comment.ReadOnly := True;
  end;
end;

The default for the Inplace edit is ReadOnly but it doesn't stop the edit from entering text into it.

I worked around it by trapping the grid on KeyDown and aborting if the InplaceEdit was set to ReadOnly.



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 28 June 2019 - 12:21 AM

Hi,

Maybe for this case is better to set Cell as read-only?
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 29 June 2019 - 12:00 AM

PS. Property is called Enabled:

 

NextGrid61.Cell[1,1].Enabled := False;

boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#4 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 02 July 2019 - 06:34 PM

I did this earlier, but found that when cell.Enabled = False the InPlaceEdit isn't shown. I am using it to give an expanded view of the cell comments to make it easier to read long text.



#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 02 July 2019 - 06:54 PM

Hm, it a little bit tricky to solve this kinds of problems. Maybe I need to call event on different place but it’s always difficult with many edge-cases.

How you tried setting ReadOnly i side OnGetInplaceEdit event instead?

Also you probably use this event to resize inplace-edit to be bigger.
http://developer.ber...=761&lang=en-us
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users