[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Non consecutive line numbers with textEditor component


On Thu, 25 Jul 2024 at 11:46, Stéphane Aulery <lkppo@xxxxxxx> wrote:

> Le 25/07/2024 à 12:03, Bruce Steers a écrit :
> >
> > On Wed, 24 Jul 2024 at 19:51, Stéphane Aulery <lkppo@xxxxxxx
> > <mailto:lkppo@xxxxxxx>> wrote:
> >
> >     Le 24/07/2024 à 20:17, Bruce Steers a écrit :
> >      >
> >      >     This somewhat special area must offer three things:
> >      >
> >      >     - Line numbering (on/off)
> >      >     - A view of the matches with context (not always consecutive
> >     so the
> >      >     numbering is not either)
> >      >     - On double click, a file editor opens the file at the
> >     indicated line
> >      >     and column
> >      >
> >      >     An editor area seems more appropriate to me, but I don't know
> >     if the
> >      >     numbering can be non-consecutive or at least the
> >     non-interesting lines
> >      >     can be hidden or folded.
> >      >
> >      >     Is this feasible with a TextEditor component?
> >      >
> >      > Anything is possible.
> >      > I do not think the TextEditor will do this by default but you
> >     could do
> >      > the following (as i myself have done in a few projects) ......
> >      >
> >      > Copy the comp/src/gb.form.editor/.src folder into your own
> projects
> >      > folder (but not the "test" folder)
> >      > un-select gb.form.editor from your project properties components.
> >      >
> >      > Now you can examine/study/edit the TextEditor imported into your
> >     project
> >      > to your hearts content and make it do anything.
> >      > (Mine has a keystroke recorder plus many other additions)
> >
> >     Very interesting. It seems more accessible to me than trying to
> create
> >     an HTML page.
> >
> >     The double click should be simple but the lines for non-consecutive I
> >     have to be inventive.
> >
> >     Can I rename the customize component to have both in the same
> rpoject?
> >
> >
> > Yes of course. It's not as easy as just modifying normally. There are
> > the following things to watch out for...
>
>
> With the first technique we couldn't simply overload the component class?
>
> --
> Stéphane Aulery
>

I do not quite understand what you mean by overload?

If you import the gb.form.editor to modify it you will either have to
remove the standard gb.form.editor component from the project properties or
rename all the imported components and rename all their internal references.

Automatic Inheritance can be a way or normal Inheritance but there are
problems with "simple overrides"
Using Automatic Inheritance (make a file called TextEditor.class in your
project and it automatically Inherits gb.form.editor/TextEditor)
Use a File of another name (like MyTextEditor.class) and use "Inherits
TextEditor" to make it inherit TextEditor.class

In my experience if for example I "only" imported the TextEditor.class file
and kept gb.form.editor in my properties but did not import the whole
gb.form.editor component I will likely get "incorrectly overridden" errors.
It seems to workhaving a class of the same name and overriding "some" of
the properties/methods but the whole original file never seems to work.

The cross-over from being able to use Inheritance or having to import the
whole source depends on if your modifications need to use Private internal
properties of the inherited class.
Meaning if your override can use Publicly accessible properties (for
example the TextEditor.Text property) then you an use Inheritance and use
Me.Text to get the Text, but if you want to access/modify something like
the Private $cDiffLayout variable there is no way to get to it as it is
private to the components TextEditor.class not your projects version.  In
that case the only way to access and modify private stuff is to import the
component.

PS, keep an eye out for useful _hidden commands (they begin with underscore
_ ) that can help like for example TextEditor1._GetDocument() that returns
the editors CDocument object.

Experimentation be the mother of progression :)

Respects
BruceS