Recent

Author Topic: [SOLVED] Insert character panel?  (Read 6293 times)

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
[SOLVED] Insert character panel?
« on: October 01, 2018, 10:09:35 am »
Has anybody done a component for inserting characters (like the Insert Symbol panel in Word) into text, which is usually used to insert characters, which cannot be typed by the keyboard?
« Last Edit: October 13, 2021, 07:38:27 am by CM630 »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Insert character panel?
« Reply #1 on: October 01, 2018, 10:19:07 am »
If you mean something like Edit -> Insert from Character Map, you already have the source for that.

MacWomble

  • Jr. Member
  • **
  • Posts: 79
Re: Insert character panel?
« Reply #2 on: October 01, 2018, 10:39:12 am »
If you mean something like Edit -> Insert from Character Map, you already have the source for that.

Not a goog answer, isn't it?

Where is the source?
Mint 19.3 Cinnamon, FPC/ Lazarus Trunk 64Bit

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Insert character panel?
« Reply #3 on: October 01, 2018, 10:51:24 am »
Why not a good answer?

Take this as a push to navigate through the Lazarus sources. You'll find the character map in folder ide of your Lazarus installation, but you'll have to apply some changes because it refers to other ide units.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Insert character panel?
« Reply #4 on: October 01, 2018, 11:07:01 am »
If you/anyone have problem opening the source, or misunderstood what that mean, or .... whatever... here is how to open the source the Character Map Dialog of the Lazarus IDE:

Lazarus main menu > File > Open > browse to and open /usr/share/lazarus/1.8.4/ide/charactermapdlg.pas

Note:
The path above is for Lazarus 1.8.4 Linux.
« Last Edit: October 01, 2018, 11:10:22 am by Handoko »

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Insert character panel?
« Reply #5 on: October 01, 2018, 12:02:43 pm »

Thanks, I had no idea that Lazarus IDE has that feature (never sought it). :o
I guess it should do.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Insert character panel?
« Reply #6 on: October 11, 2021, 11:06:37 am »
I tried to use it...
I created a new project, opened charactermapdlg.pas, added it to the project, tried to compile the project.
The compiler did not find IDEHelpIntf, so I added ideintf.lpk to the project.
Then I added synedit.lpk to the project.

Then I added ...\lazarus\ide\include\ide.inc to the project.
Then I added codetools.lpk.
Then I added debugger.pp.
Then I added debuggerintf.lpk.
And then ..\lazarus\ide\lazconf.pp complained that it cannot find lazconf.inc, so it occurred that there are multiple files with that name in the Lazarus folder, I added the lazconf.inc[/size] in the folder of the OS I use[/size].
And maybe then I added sth. else.
And the project compiled!

But when I did

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button2Click(Sender: TObject);
  2. var
  3.   CharMap: TCharacterMapDialog;
  4. begin
  5.   CharMap:=TCharacterMapDialog.Create(self);
  6.   CharMap.Show;
  7. end;
an exception is thrown in
Code: Pascal  [Select][+][-]
  1. procedure TCharacterMapDialog.FormShow(Sender: TObject);
  2. begin
  3.   AnsiGrid.Font.Name := EditorOpts.EditorFont;
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Insert character panel?
« Reply #7 on: October 11, 2021, 12:16:36 pm »
It was not clear from your post that you need a standalone charactermap. The one in the ide folder, however, is integrated into the IDE and cannot be used outside the IDE without changes.

Changes, however, are easy, and I am attaching a demo in which the IDE's charactermap is extracted to be usable in your own programs. If you want to send characters from the char map to an edit or memo control you must write a handler for the OnInsertCharacterMap which has the character selected in the map as a string parameter. If you don't like the font (I increased the font size to improve legibility of the map characters) adjust the EditorFont of the map.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Insert character panel?
« Reply #8 on: October 11, 2021, 12:18:24 pm »
And just what is that exception ?

Maybe the font name has not been set in your project ?  Or the object not created ?  I think I would start by removing as much as possible of the Lazarus IDE units from the CharacterMapDlg. (You did make a local copy of it, didn't you ?)

Maybe hard wire a font name until you understand how it all works, EditOpts is from another unit altogether, probably not what you want to use anyway.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Insert character panel?
« Reply #9 on: October 12, 2021, 07:21:13 pm »
...I am attaching a demo in which the IDE's charactermap is extracted to be usable in your own programs. If you want to send characters from the char map to an edit or memo control you must write a handler for the OnInsertCharacterMap which has the character selected in the map as a string parameter...
Thanks, your sample works, I have added it in my project succesfully.

And just what is that exception ?
Maybe the font name has not been set in your project ?  Or the object not created ?  I think I would start by removing as much as possible of the Lazarus IDE units from the CharacterMapDlg. (You did make a local copy of it, didn't you ?)
Maybe hard wire a font name until you understand how it all works, EditOpts is from another unit altogether, probably not what you want to use anyway.
Davo
Looking in @wp's sample, I suppose that the .pas file did not find the .lfm file, so AnsiGrid.Font.Name := EditorOpts.EditorFont; crashed, because it did not see AnsiGrid as a created item.
« Last Edit: October 13, 2021, 07:40:34 am by CM630 »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Insert character panel?
« Reply #10 on: October 12, 2021, 07:25:51 pm »
@CM630: your reply #9 is unreadable.
Mostly because you use so many font tags and place them in the wronf place or don't close them.

Bart

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Insert character panel?
« Reply #11 on: October 12, 2021, 07:29:53 pm »
Really, what is the problem to re-read a message after posting? How can this happen?

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Insert character panel?
« Reply #12 on: October 12, 2021, 07:30:46 pm »
My EPlus editor has a similar map that inserts HTML escape codes.
You can take a look at https://sourceforge.net/p/flyingsheep/code/HEAD/tree/trunk/EPlus/, the files in question are htmlcharmap.pp and htmlcharmap.lfm.
Any dependancies can be foud either in this folder or in the https://sourceforge.net/p/flyingsheep/code/HEAD/tree/trunk/MijnLib/ folder.

Feel free to rip, use or misuse (they are LGPL).

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Insert character panel?
« Reply #13 on: October 12, 2021, 07:31:34 pm »
Really, what is the problem to re-read a message after posting?
Or use "Preview" button before clicking "Post"...

Bart

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Insert character panel?
« Reply #14 on: October 13, 2021, 02:17:04 am »
..... Some totally incoherent stuff ....
crashed, because it did not see AnsiGrid as a created item.
....

CM, again, I ask, have you made a stand alone copy of the IDE's version pf Character Map ?   Do that and you can then remove (better initially to comment out) app the external things and just concentrate on the things you want to keep.  It appears however that ANSIGrid may not be being created, again, in an isolated project, you cannot rely on external things that may be triggering, in this case a create.  So, try to find where ANSIGrid is created and see why its not happening ?

But didn't WP send you a working version of a standalone characterMap, looked to me like it was a good starting place (indeed, I downloaded it and tucked it away for future use  8)

Davo

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018