Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-09 Thread Bo Berglund via lazarus
On Wed, 8 Dec 2021 16:39:55 -0500, Dmitry Boyarintsev via lazarus
 wrote:

>> Is there some non-standard package I could install (from  OLPM or similar)
>> in
>> order to get it working again?
>>
> you might want to try TRichMemo
>
>it provides some sort of compatibility with TRichEdit
>https://wiki.freepascal.org/RichMemo#TRichEditForMemo
>
>thanks,
>Dmitry

I looked at the wiki page:
https://wiki.freepascal.org/RichMemo

And the Download section says:
"The easiest way to install the stable version of the component is via the
Online-Package-Manager"

THis was the best way, so I did this and then I replaced the TRichEdit panels
with the TRichMemo instead.

With some small tweaks it seems like it is now working! :-)

THANK YOU for your pointer towards this component! Much obliged!


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-09 Thread Dmitry Boyarintsev via lazarus
On Thu, Dec 9, 2021 at 5:23 AM John Landmesser via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> If i remember correct  TRichMemo won't be usable on Linux.
>

According to Bo's needs (showing colored Hex values) RichMemo will work
just fine for Linux. (Both Qt and Gtk2)

thanks,
Dmitry
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-09 Thread Werner Pamler via lazarus

Am 09.12.2021 um 16:19 schrieb Bo Berglund via lazarus:

How can I use this?


Very easy: just load the file

procedure TForm1.FormCreate(Sender: TObject);
begin
  hex := TMpHexEditor.Create(self);
  hex.Parent := self;
  hex.Align := alClient;
  hex.LoadFromFile('Project1.exe');
end;

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-09 Thread Luca Olivetti via lazarus

El 9/12/21 a les 16:19, Bo Berglund via lazarus ha escrit:

On Thu, 9 Dec 2021 16:01:01 +0100, Luca Olivetti via lazarus
 wrote:


El 9/12/21 a les 15:05, Bo Berglund via lazarus ha escrit:



If not is there another Lazarus component that can be used?


Maybe you could use TMPHexEditorEx

https://github.com/michalgw/mphexeditor



I went there but I found no documentation...


there's a chm file (which I didn't use) and a couple of examples. Then 
there's google, duckduckgo and other search engines.




There is a doc/MPHexEditor.chm file but it does not display anything except
headings on my Windows-10 PC...


Ah, Ok, as I didn't use it (I didn't even see it was there) I cannot 
tell, I just used the examples and looked at the properties in the 
object inspector.




How can I use this?

Notice that I do not want to *edit* any data just display them in a matrix where
the bytes corresponding to a data item are highlighted.


It's up to you to check it out. If, by adjusting some properties, can do 
what you want, good, if not you'll have to look for something else :-(


I can only say that it has some bugs: in my case, I tried to adjust the 
BytesPerColumn property at design time and it made the form unloadable.

I just set it during FormShow and it's fine (for my needs).


Bye

--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-09 Thread Bo Berglund via lazarus
On Thu, 9 Dec 2021 16:01:01 +0100, Luca Olivetti via lazarus
 wrote:

>El 9/12/21 a les 15:05, Bo Berglund via lazarus ha escrit:
>
>> 
>> If not is there another Lazarus component that can be used?
>
>Maybe you could use TMPHexEditorEx
>
>https://github.com/michalgw/mphexeditor
>

I went there but I found no documentation...

There is a doc/MPHexEditor.chm file but it does not display anything except
headings on my Windows-10 PC...

How can I use this?

Notice that I do not want to *edit* any data just display them in a matrix where
the bytes corresponding to a data item are highlighted.


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-09 Thread Luca Olivetti via lazarus

El 9/12/21 a les 15:05, Bo Berglund via lazarus ha escrit:



If not is there another Lazarus component that can be used?


Maybe you could use TMPHexEditorEx

https://github.com/michalgw/mphexeditor

Bye

--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-09 Thread Bo Berglund via lazarus
On Wed, 8 Dec 2021 23:28:23 +0200, "R.Smith via lazarus"
 wrote:

>> Is there some non-standard package I could install (from  OLPM or similar) in
>> order to get it working again?
>
>Not really. The problem is TRichEdit was just a wrapper for the MS 
>Windows RichEdit component, which was born before the days of HTML 
>componenets, so far inferior to anything new. It does not exist anywhere 
>else in the world and so not useful on a cross-platform development 
>system. Not sure if anybody reverse-engineered the RichEdit 
>functionality, but if Google doesn't know then I am relatively sure 
>there isn't.
>

OK,
I do not think I need a TRichEdit just to show the data, a TMemo would probably
suffice as long as I can set a font like Licida Console or other fixed width
font.

But I also need to be able to set the text selection in code...

The application is used to display a panel of the hex representation of the
binary data loaded from file.

When the user selects a data item in a separate item list the corresponding hex
values in the panel shall be selected. The amount of data varies from item to
item and this is the reason for the display.

Also, if a user clicks on a value in the hex list the corresponding data item in
the data list shall be selected and the full scope of the data item selected in
the hex view.

So I need a display component that can handle this:
- an address panel to the left of the main panel, not part of the list
- a main panel showing the hex data in rows of 16 values each
- the data lines shall scroll in sync with the address panel
- the hex values of a data item shall be selected in the main panel
- if the user clicks in the hex panel the clicked item shall be selected

Problems:

Can TMemo handle this?

If not is there another Lazarus component that can be used?


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-09 Thread Dmitry Boyarintsev via lazarus
On Thu, Dec 9, 2021 at 5:23 AM John Landmesser via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> If i remember correct  TRichMemo won't be usable on Linux.
>

To a certain extent, yes - not all features are available

thanks,
Dmitry
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-09 Thread John Landmesser via lazarus

Am 08.12.21 um 22:39 schrieb Dmitry Boyarintsev via lazarus:

On Wednesday, December 8, 2021, Bo Berglund via lazarus
 wrote:

Is there some non-standard package I could install (from  OLPM or
similar) in
order to get it working again?

 you might want to try TRichMemo

it provides some sort of compatibility with TRichEdit
https://wiki.freepascal.org/RichMemo#TRichEditForMemo

thanks,
Dmitry




If i remember correct  TRichMemo won't be usable on Linux.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-08 Thread Bo Berglund via lazarus
On Wed, 8 Dec 2021 23:28:23 +0200, "R.Smith via lazarus"
 wrote:

>> So How can I:
>>
>> 1) Replace the main form of a Lazarus program with another form?
>> or
>> 2) Create a new program in Lazarus where I can specify an existing form as 
>> the
>> main program form.
>>
>> Either of these will work, but I don't really know how to do any of them.
>
>This is quick to do -
>via the GUI:
>
>In the Project Options, simply go to "Forms" and make sure the topmost 
>one is the one you want to load as your main form.

Wel, my form is not shown here either as active or available.
I added the unit via Project Inspector using the Add button...


>via Code:
>
>Open the program file (Project --> View Source) and make sure in the 
>code section the very first "Application.CreateForm(...)" that appears 
>is the one for your desired main form.

In the source I had to:
- Add the form unit to the uses clause and remove Unit1
- Change the Application.CreateForm call to use the specific form
- Erase Form1 from the lpr file
- Remove Unit1 in Project Inspector.

>Basically TApplication regards the first form it opens as the "main" 
>form, which simply means that that form is shown automatically first 
>(unless specified not to) and that it will exit when that form closes 
>(and a few more small things).

OK, so now I have to solve the dependencies that popped up regarding used units
in the now main form...


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-08 Thread Dmitry Boyarintsev via lazarus
On Wednesday, December 8, 2021, Bo Berglund via lazarus <
lazarus@lists.lazarus-ide.org> wrote:
>
> Is there some non-standard package I could install (from  OLPM or similar)
> in
> order to get it working again?
>
 you might want to try TRichMemo

it provides some sort of compatibility with TRichEdit
https://wiki.freepascal.org/RichMemo#TRichEditForMemo

thanks,
Dmitry
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-08 Thread R.Smith via lazarus

On 2021/12/08 22:44, Bo Berglund via lazarus wrote:

I need to port an old Delphi program to FPC/Lazarus and it contains two
TRichEdit components.

When I try to open the form in Lazarus 2.0.12 on Windows 10 with Fpc 3.2.0 I get
an error because the TRichEdit component does not exist

Is there some non-standard package I could install (from  OLPM or similar) in
order to get it working again?


Not really. The problem is TRichEdit was just a wrapper for the MS 
Windows RichEdit component, which was born before the days of HTML 
componenets, so far inferior to anything new. It does not exist anywhere 
else in the world and so not useful on a cross-platform development 
system. Not sure if anybody reverse-engineered the RichEdit 
functionality, but if Google doesn't know then I am relatively sure 
there isn't.





I have a new laptop now and I have no new Delphi version installed (except for
Delphi 7 with the no-nonsense license). I am only using Fpc + Lazarus nowadays.

Another question while I am here:
-

The form I have problems with is a special calculation sheet in one single form,
which is part of the source program.
But I only need to port this form into the new Lazarus program so I tried to
create a new program from scratch and intended to replace the default form as
the main form.
But I don't know really how to do this...

So How can I:

1) Replace the main form of a Lazarus program with another form?
or
2) Create a new program in Lazarus where I can specify an existing form as the
main program form.

Either of these will work, but I don't really know how to do any of them.


This is quick to do -
via the GUI:

In the Project Options, simply go to "Forms" and make sure the topmost 
one is the one you want to load as your main form.


via Code:

Open the program file (Project --> View Source) and make sure in the 
code section the very first "Application.CreateForm(...)" that appears 
is the one for your desired main form.


Basically TApplication regards the first form it opens as the "main" 
form, which simply means that that form is shown automatically first 
(unless specified not to) and that it will exit when that form closes 
(and a few more small things).



--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus