Author Topic: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?  (Read 6903 times)

Doug Clark

  • Sr. Member
  • ****
  • Posts: 307
  • Karma: +7/-1
    • View Profile
Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« on: April 22, 2021, 05:18:18 am »
Has anyone successfully used the EPM Etoolkit  to create an EPM based MLE in a VisualAge C++ v 3.0 IOC application?

Sample 2 from the etoolkit shows an E-MLE inside of an EFrame inside of an application window.  The E-MLE is the actual editor guts; the EFrame adds scroll bars, message line, title bar etc.  I lightly modified sample 2 from the etoolkit SDK, compiled with VAC 3.0 and it works - attached as epm_sample2.zip

But when I convert that into a "custom control" as a C++ class, to integrate with the user interface part of the IOC library, part of the E-MLE stops working.  It appears to be the part that sends messages, or receives messages related to editor commands.  What I THINK is happening is the dispatcher that the IOC uses to intercept and route window messages is somehow not sending the messages to the E-MLE window procedure.  Or rather some of the messages, because other messages clearly are getting through.

So has anyone converted a customized PM window/control into a IOC user interface object that can be inserted into various other IOC UI objects?

epm_sample2.zip is the lightly modified Sample 2 from the eToolkit sdk.   
testmain.zip contains my class EpmMle (descended from IControl) which is my attempt to integrate an EFrame/E-MLE into a custom control that can be used in IOC.  Run testmain.exe from testmain.zip and try issuing a command from the menu;  Command - Command Dlg and then type some EPM command, such as SAYERROR 'Hello'   You will need the VAC 3.0 runtime libraries to run testmain.exe





« Last Edit: April 22, 2021, 05:28:26 am by Doug Clark »

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #1 on: April 22, 2021, 08:07:16 am »
I've never tried to compile the examples myself. I had problems with two of the four example's .exes, when another EPM was open. I've just tried it again and all four start now.

We discussed to create our own GUI app at NEPMD. I thought that this approach was too complex, but at that time I had not even a compiler. Looking back, that seems to be not completely wrong. But alone the ETK functions have so many bugs, that I would start there first if I had the ETK source. For most of them, I've added workarounds and have now the skills to fix at least just a few of them, if the sources would have been released. The GUI would be another story, but must flaws are in the ETK. It would be much better to start with a supported and well-spread toolkit, e.g. Scintilla. Also Kate looks very promising. Of course that requires to change the compiler, too.


Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #2 on: April 22, 2021, 08:29:13 pm »
Has anyone successfully used the EPM Etoolkit  to create an EPM based MLE in a VisualAge C++ v 3.0 IOC application?

Sample 2 from the etoolkit shows an E-MLE inside of an EFrame inside of an application window.  The E-MLE is the actual editor guts; the EFrame adds scroll bars, message line, title bar etc.  I lightly modified sample 2 from the etoolkit SDK, compiled with VAC 3.0 and it works - attached as epm_sample2.zip

But when I convert that into a "custom control" as a C++ class, to integrate with the user interface part of the IOC library, part of the E-MLE stops working.  It appears to be the part that sends messages, or receives messages related to editor commands.  What I THINK is happening is the dispatcher that the IOC uses to intercept and route window messages is somehow not sending the messages to the E-MLE window procedure.  Or rather some of the messages, because other messages clearly are getting through.

So has anyone converted a customized PM window/control into a IOC user interface object that can be inserted into various other IOC UI objects?

epm_sample2.zip is the lightly modified Sample 2 from the eToolkit sdk.   
testmain.zip contains my class EpmMle (descended from IControl) which is my attempt to integrate an EFrame/E-MLE into a custom control that can be used in IOC.  Run testmain.exe from testmain.zip and try issuing a command from the menu;  Command - Command Dlg and then type some EPM command, such as SAYERROR 'Hello'   You will need the VAC 3.0 runtime libraries to run testmain.exe

I also played around with it and created a very simple editor. What I vaguely remember is that if you want to invoke a editor built-in command, you need to use the "post" window message otherwise EPM will get unsynchronized/run into concurrency issues if it runs on more than one thread (which it will do if you invoke a command that takes a longer time to process).

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #3 on: April 22, 2021, 09:22:31 pm »
What I vaguely remember is that if you want to invoke a editor built-in command, you need to use the "post" window message
Yes, that's true. almost all ETK messages are posted. From the EPM code (NEPMD macros), these are the few ones that are sent:
Code: [Select]
Send_Config_Data
Set dialog title (ProofDlg)
Set current word being proofed (ProofDlg)
Disable buttons (ProofDlg)
Set default button (ProofDlg)
Set dialog prompt (ProofDlg)
Fill listbox (ProofDlg)
Set entry field (ProofDlg)
Disable everything (ProofDlg)
EPM_EDIT_LOGAPPEND
EPM_FRAME_STATUSLINE
EII_EDIT_REFRESHSTATUSLINE
EPM_FRAME_STATUSLINE
EPM_FRAME_MESSAGELINE
EPM_EDIT_LOGERROR
(SetMenuAttribute)
MM_SetItemText
MM_QueryItem
MM_SETDEFAULTITEMID
EPM_EDIT_KW_QUERYPARSE
EFRAMEM_ToggleControl
EPM_EDIT_CONTROLTOGGLE
EPM_Edit_Query_Help_Instance
HM_SET_HELP_LIBRARY_NAME
(RenderUndoInfo)

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #4 on: April 23, 2021, 08:26:58 am »
Not sure if we are talking about the same thing.
To clarify, I am talking about the EPM API equivalent of the /postme command line option.
For example, in another "project", I am using EPM to load a source file, scroll to a code line containing an error plus displaying the error message in the status line. I invoke EPM from a command line and use the /postme switch on all 3 actions: loading the source file, scrolling to code line and finally, displaying the error text in the status line.
If I do not use the /postme switch, scrolling to the code line will fail because the file is not loaded in time. Using the /postme switch properly serializes these actions.
« Last Edit: April 23, 2021, 08:36:46 am by Lars »

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #5 on: April 23, 2021, 02:35:22 pm »
Not sure if we are talking about the same thing.
Yes, we do. All ETK functions can be accessed from both C and E. As long as the NewEditWndClass is involved, the ETK is used. Prepending a command with the postme command (it's not a switch) resolves in the end into one or several posted (as the opposite to sent) ETK or other messages.

Using postme on file loading is most of the time necessary, because file loading takes a while and a command should be executed after a file has been loaded. (BTW: I remember that I had to use 3 cascaded postmes, e.g. for making the highlight circle stay. Of course, I try to minimize them.)

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #6 on: April 24, 2021, 04:52:30 pm »
I had problems with two of the four example's .exes, when another EPM was open. I've just tried it again and all four start now.
That was wrong: The .exe files of the 6.00c samples start. The .exe files from the 6.03b samples 2 and 4 start only if EPM 6.03b is not running. That ETK version comes from DevCon and a friendly guy sent it to me.
« Last Edit: April 25, 2021, 08:56:03 pm by Andreas Schnellbacher »

Doug Clark

  • Sr. Member
  • ****
  • Posts: 307
  • Karma: +7/-1
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #7 on: April 25, 2021, 06:17:14 pm »
Could you post the  6.03b version of the ETK here please?

Doug Clark

  • Sr. Member
  • ****
  • Posts: 307
  • Karma: +7/-1
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #8 on: April 25, 2021, 06:53:36 pm »
Okay - it appears my problem is the open class library is stripping off mp2 for command messages.  Mp2 is where the EPM "command" is stored when it sends an EPM_EDIT_COMMAND message to itself (rather to the E-MLE window)

I think this because 1) mp2 in a EPM_EDIT_COMMAND message is, essentially, blank by the time it arrives as the E-MLE window procedure.  And 2) because of what I read in the book "Power Gui Programming with VisualAge for C++"

Quoting from the book
"An Open Class LIbrary library application is a presentation system application. Open Class Library itself provides a single window procedure that operates for most window represented by IWindow objects.  Every time you create an object derived from IWindow [which you must do to integrate a non-OCL routine with the OCL application - my addition] the object registers this window procedure as a subclass window procedure.   As a result, Open Class Library's window procedure gets the first chance to process all messages that the presentation system sends to a window."

Quoting again later in the book
"Open Class Library treats the field that identifies the source of the command (the high word of IEventParameter1 in the Windows operating system or the low word of the IEventParameter2 value in the OS/2 operating system) as if it contains only that value instead of data that you choose."  It goes on to say that as it passes that event (window procedure message) it alters the value in mp2.

Has anybody written an open class library handler to capture application messages before they get routed through the open class library ICommandHandler?

My current solution is to pull off the value that should be in mp2, store it somewhere in memory, subclass the E-MLE window procedure and for each type of EPM_EDIT_COMMAND message translate into an EtkExecuteCommand() function call.  Which is crude and I will have to do that for each ETK message that needs to transfer something in mp2.

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #9 on: April 25, 2021, 09:23:28 pm »
I don't think that many have ever used OCL. Finding someone with experience wouldn't be easy.

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Anyone used the EPM - eToolKit to make an MLE for VAC 3.0?
« Reply #10 on: April 26, 2021, 08:01:28 pm »
Could you post the  6.03b version of the ETK here please?
Uploaded to Hobbes.

I forgot to mention that this one is from 1996-06-07.
« Last Edit: April 26, 2021, 08:31:50 pm by Andreas Schnellbacher »