cancel
Showing results for 
Search instead for 
Did you mean: 

Delphi and UI API event handling

Former Member
0 Kudos
193

Has anyone any experience (and sample code) with using the UI API event handling in Delphi?

We have a partner that wants to use Delphi to develop an integration between SBO and another product. To be able to do this the way we want, they need to use the Application Events, Menu Events and Item Events in the UI API.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Trond, I have had absolutely no joy in using the UI API in Delphi, the UI API event handling raises exceptions and error when you try to evaluate the pVal object parameters. The DI works fine in Delphi and I've used it to handle data integration between SBO and another product. I did the UI API testing using Delphi 7 but I now use C# to write add-ons using the UI API. I'd be greatly interested myself to know if any other Delphi developers have managed to successfully use the UI API.

Lita

Former Member
0 Kudos

Hi,

We're using Delphi for the Add-On development.

For some reason Delphi has problems to access the pval parameter in the menu and item events.

We're using the imported Type Libray to allow code completing in the editor. I renamed some classes (eg. TForm) to avoid conflicts with the VCL. I have to check if the problems also occur when using late binding instead.

Delphi 7:

No access to pval parameter in BOTH events

Delphi 6:

Allows access to pval parameter in the item event but NOT in the menu event.

This is fine as long as no new menu items are required.

Delphi 8:

Allows access to all parameters in all events after reference assemblies where added.

I personally don't prefer D8 for the Add-On development because the requirements (.NET Framework, additional assemblies) for the deployment are much higher - not mention the size.

A tiny app with a few 100 KB is more desirable than 3+ MB plus the .NET Framework.

I'm in contact with the Borland Support and they're investigating the problems with the COM-Server.

But it's difficult, because without SBO they're not able to replicate the problem...

Regards,

Gerold

Former Member
0 Kudos

Hi,

W're using Delphi 5 for development.

Can you explain how to catch the events with the gui object? Normally i do this with the object inspector, but this component isn't visible in the inspector.

Thanks in advance,

Regards,

Paul

Former Member
0 Kudos

Hi Paul,

1. Define Event Procs

procedure con_ItemEvent(Sender: TObject; var FormUID: OleVariant;var pVal: OleVariant; var BubbleEvent: OleVariant);

procedure con_MenuEvent(Sender: TObject; var pVal: OleVariant; var BubbleEvent: OleVariant);

procedure con_AppEvent(Sender: TObject; EventType: BoAppEventTypes);

2. Put your code in the procs

procedure TfrmMain.con_ItemEvent(Sender: TObject; var FormUID: OleVariant; var pVal: OleVariant; var BubbleEvent: OleVariant);

// form and item events using IItemEvent

begin

...

if pval.ItemUID='1' then // OK button

begin

if pval.Before_Action then

..

end

end;

procedure TfrmMain.con_AppEvent(Sender: TObject; EventType: BoAppEventTypes);

// handle app events

begin

case EventType of

aet_ShutDown : begin

vCmp.Disconnect;

Close;

end;

aet_CompanyChanged : begin // connect to new company

vCmp.Disconnect;

ActivateApplication;

end;

aet_LanguageChanged : ;

aet_ServerTerminition : ;

end;

end;

3. Assign Event Procs

SBO_App.OnAppEvent:=con_AppEvent; // application / company

SBO_App.OnItemEvent:=con_ItemEvent; // forms and controls

SBO_App.OnMenuEvent:=con_MenuEvent; // main menu and toolbar

I hope this helps.

Sorry, the formatting is gone after pasting the code.

Can you access the pval parameter for the menu event in Delphi 5?

Regards,

Gerold

Former Member
0 Kudos

I use Delphi 2005 & SBO 2004B (patch35)

My problem is, I can't find .OnAppEvent, .OnItemEvent and .OnMenuEvent. So, I can't assign the event procs.

hmm... what do you think about it?? That's why I can't proceed to write the addon by Delphi...

SBO_App.OnAppEvent:=con_AppEvent; // application / company

SBO_App.OnItemEvent:=con_ItemEvent; // forms and controls

SBO_App.OnMenuEvent:=con_MenuEvent; // main menu and toolbar

Answers (0)