Forum > LCL

scrolling Tmemos simultaneously ?

(1/12) > >>

Etienne_L:
Hi all,

I would like two Tmemos to scroll simultaneously  ( to move in a text and a translation ).

Could be
- catching scrolling events in one Tmemo and propagate them to the other ?
- programmatically setting the starting position of the visible part of the text in the Tmemos, in an event handler of an external, master scrollbar ?

I tried, but did not succeded. Thanks for hints !

Etienne

P.S. Target are windows and linux, but just one platform would already be good help.

wizzwizz4:
In idiomatic Tcl/Tk, you would solve this by putting both Tmemos in a frame, expanded vertically so they fill all available space (and increase the frame's bounding box as necessary), and attaching a scrollbar to it in the usual manner. Is that approach possible here? Maybe with a TScrollBox?


--- Quote from: Etienne_L on October 03, 2024, 03:15:29 pm ---programmatically setting the starting position of the visible part of the text in the Tmemos, in an event handler of an external, master scrollbar ?
--- End quote ---

If you take this approach, you also need to set the height of the external scrollbar to the height of the Tmemos if/when that changes. If they have different heights to each other, you need a way to reconcile them: maybe taking the maximum? Depends what you're trying to achieve.

wizzwizz4:
This feature is implemented in kdiff3, a Qt program written in C++. You might be able to re-use the design. I think the relevant file is difftextwindow.cpp.

Joanna from IRC:
I believe the original poster who has abandoned thread was asking about tmemo lcl controls in Lazarus

MarkMLl:

--- Quote from: Joanna on October 05, 2024, 05:20:52 pm ---I believe the original poster who has abandoned thread was asking about tmemo lcl controls in Lazarus

--- End quote ---

I suggest not jumping to that sort of conclusion prematurely, since he might merely be waiting for an answer he understands.

The suggestion of referring to a C++ file in extremis is entirely valid, in the absence of other suggestions.

I've done a little bit of manipulation of TMemo/TRichMemo positioning (in the context of /preventing/ it from tracking program-initiated inserts) but in no way consider myself an expert. In the interest of providing /something/ which might possibly be useful some of the relevant stuff is at https://forum.lazarus.freepascal.org/index.php/topic,67337.msg519191.html#msg519191

MarkMLl

Navigation

[0] Message Index

[#] Next page

Go to full version