Recent

Author Topic: SynEdit question(s)  (Read 1124 times)

440bx

  • Hero Member
  • *****
  • Posts: 4906
SynEdit question(s)
« on: November 27, 2024, 07:06:10 am »
Hello,

Is it possible to have some lines be read-only mixed with lines that are read-write ? if the answer is yes, what properties or methods are used to control that line characteristic ?

If the answer is no, I'd like to have an estimate of how difficult and how much work it would be to add that feature to SynEdit.

Thank you for your help.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1295
Re: SynEdit question(s)
« Reply #1 on: November 27, 2024, 09:54:56 am »
Doesn’t edit by definition mean that you can change things though?
« Last Edit: November 27, 2024, 04:47:29 pm by Joanna from IRC »
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10692
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit question(s)
« Reply #2 on: November 27, 2024, 10:33:02 am »
Not as part of the editor itself. There are no per line options.

But you can hook the keydown/up or On[User]Command and Mouse events, and then stop them.

Or you can react to caret move, and change readonly in the event. Though I don't know if combined actions will check after they moved the caret.... (e.g. middle button paste).

Otherwise by which means is it to be decided?

440bx

  • Hero Member
  • *****
  • Posts: 4906
Re: SynEdit question(s)
« Reply #3 on: November 27, 2024, 03:19:53 pm »
Doesn’t edit by definition mean tha5 you can change things though?
Yes but, edit does not imply everything is editable.



Not as part of the editor itself. There are no per line options.

But you can hook the keydown/up or On[User]Command and Mouse events, and then stop them.
I can see how that would work.  Very useful observation, thank you Martin.

Or you can react to caret move, and change readonly in the event. Though I don't know if combined actions will check after they moved the caret.... (e.g. middle button paste).
I'll look into that.

Otherwise by which means is it to be decided?
In this particular case, text that is generated by the program is not editable whereas text that is user-entered is.

To give an example that is "parallel" to what I intend to do, imagine a user can add comments to the debugger's dis-assembly window, those comments may be edited at any time while the dis-assembly text (which is generated by the debugger) is normally read-only.

Question: is the dis-assembly window a SynEdit or is it a different control ?

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1295
Re: SynEdit question(s)
« Reply #4 on: November 27, 2024, 04:48:48 pm »
Ah , are you using synedit within your own project? That makes sense
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

440bx

  • Hero Member
  • *****
  • Posts: 4906
Re: SynEdit question(s)
« Reply #5 on: November 27, 2024, 05:00:24 pm »
Ah , are you using synedit within your own project? That makes sense
I am seriously considering it which is why I have questions about it.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10692
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit question(s)
« Reply #6 on: November 27, 2024, 05:45:54 pm »
For the key/mouse events

You do need to check if there is a selection, and if the selection contains protected text.

You should probably not use multi caret. And also not use syncro edit. Those will make the checks a lot harder.


440bx

  • Hero Member
  • *****
  • Posts: 4906
Re: SynEdit question(s)
« Reply #7 on: November 27, 2024, 07:09:21 pm »
For the key/mouse events

You do need to check if there is a selection, and if the selection contains protected text.

You should probably not use multi caret. And also not use syncro edit. Those will make the checks a lot harder.
I'll follow that advice.  Thank you Martin.

Curiosity question: is the dis-assembly window a SynEdit or is it a different control ?
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10692
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit question(s)
« Reply #8 on: November 27, 2024, 07:37:24 pm »
The disassembly is a custom control. With its own paint handler.

440bx

  • Hero Member
  • *****
  • Posts: 4906
Re: SynEdit question(s)
« Reply #9 on: November 27, 2024, 08:28:25 pm »
The disassembly is a custom control. With its own paint handler.
I wondered if it was a SynEdit.  Thank you for making it clear it isn't.

Again out of curiosity, if you know, what justified using a custom control instead of a SynEdit or a customized SynEdit descendent ?
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10692
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit question(s)
« Reply #10 on: November 27, 2024, 10:57:46 pm »
Again out of curiosity, if you know, what justified using a custom control instead of a SynEdit or a customized SynEdit descendent ?

I don't know. It had been that way since before I even knew about Lazarus.

Then again, back in those days, SynEdit was far less capable.
« Last Edit: November 27, 2024, 11:01:16 pm by Martin_fr »

440bx

  • Hero Member
  • *****
  • Posts: 4906
Re: SynEdit question(s)
« Reply #11 on: November 27, 2024, 11:40:01 pm »
I don't know. It had been that way since before I even knew about Lazarus.

Then again, back in those days, SynEdit was far less capable.
Thanks. Good stuff to know.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018