views:

165

answers:

1

Hi all,

I'm having an issue I'd like so get some feedback on. I'm not going to detail the exact issue about how my application functions as it really doesn't matter in this case.

I'm using PB 11.5 and have been tasked with converting a Win32 app to WINFORMS.

Suppose I didn't like the look of the PB command buttons and wanted to create my own button using System.Windows.Forms - I can do this and get the button to show up on my window. My problem comes in what do I do when the user clicks on it?

How do I trap the fact that they did this? It's a button created in my #if defined PBWINFORM section of code and it's done at runtime, there is no control associated with it and therefore no clicked event.

Is there a simple way to capture this clicked event that I'm missing?

Based on some ideas I have been able to find while searching the web I have created an "interface" program in C#. I basically register the button object that I've dynamically created in my code along with a PB NVO. I've coded this C# program so that the buttons event handler for "click" triggers an event of the PB NVO that I registered. So my NVO has a "clicked" event that functions like the clicked event of a button.

This is all working pretty well, but I hoping there might be a simpler way to have done this without having to create this NET inferace?

Thanks for any responses.

Pat

A: 

You found the best way. You can't wire up events like you want in PB Winforms.

Brad Wery