Recent

Author Topic: Disable an TMemo...  (Read 1739 times)

Espectr0

  • Full Member
  • ***
  • Posts: 221
Disable an TMemo...
« on: February 10, 2024, 05:11:22 pm »
Hola,

As the title says, make a new project, put a TMemo and disable it "memo1.Enabled := False", it only disables the use of the mouse, with the keyboard I can continue writing...
is this a bug?

Gracias

TRon

  • Hero Member
  • *****
  • Posts: 3769
Re: Disable an TMemo...
« Reply #1 on: February 10, 2024, 05:23:52 pm »
is this a bug?
I would expect it is (I am not sure as I do not know enough about macos widgetset internals) because I was unable to locate a specific mention about the subject on the wiki for both carbon and cocoa. Status for widgetset/controls can be read here (though the last update was over a year ago)

edit: assuming you are using cocoa, the nstextview's superclass NSText seem to support disabling text editing (see also apple docs) though I have no idea how that would work out in the LCL widgetset/interface implementation.
« Last Edit: February 10, 2024, 05:37:46 pm by TRon »
I do not have to remember anything anymore thanks to total-recall.

Espectr0

  • Full Member
  • ***
  • Posts: 221
Re: Disable an TMemo...
« Reply #2 on: February 10, 2024, 08:16:48 pm »
Thanks, I'll do some research

Hansaplast

  • Hero Member
  • *****
  • Posts: 689
  • Tweaking4All.com
    • Tweaking4All
Re: Disable an TMemo...
« Reply #3 on: February 11, 2024, 10:00:55 am »
Feels like a bug indeed.
Just commenting to confirm that I'm seeing this here as well with Lazarus fromtrunk.
Lazarus 3.99 (rev main_3_99-1411-g2c81dff5d9) FPC 3.3.1 aarch64-darwin-cocoa

TRon

  • Hero Member
  • *****
  • Posts: 3769
Re: Disable an TMemo...
« Reply #4 on: February 11, 2024, 01:40:18 pm »
@Hansaplast:
Thank you for the confirmation and report.

@Espectr0:
Would be nice that in case you got somewhere if you are able to share, if only to update the wiki to confirm the current status. Unfortunately it seems a bit like a lonely task as in all these years it does not seem to have been mentioned/raised once (but tbh I did not spent too much time in the bugtracker about this particular issue).
I do not have to remember anything anymore thanks to total-recall.

Manlio

  • Full Member
  • ***
  • Posts: 164
  • Pascal dev
Re: Disable an TMemo...
« Reply #5 on: March 12, 2024, 01:37:54 pm »
A work-around I used in similar situations is to place the misbehaving control inside a TPanel, and then disable the TPanel. Everything inside the TPanel then becomes disabled.

However, notice that when the TPanel is disabled and the controls inside it are effectively disabled too, the appearance of the controls may still be as if they were enabled. In those cases, besides making the parent control disabled, I also change the color of the child controls, for example from white to gray, to make it visually clear to the user that they are disabled.
manlio mazzon gmail

jcmontherock

  • Sr. Member
  • ****
  • Posts: 274
Re: Disable an TMemo...
« Reply #6 on: March 12, 2024, 03:38:47 pm »
Or: Memo1.ReadOnly := True;...
Windows 11 UTF8-64 - Lazarus 4RC1-64 - FPC 3.2.2

 

TinyPortal © 2005-2018