Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Custom controls implemented as shared library

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Custom controls implemented as shared library
#2673
Posted by: 2003-09-25 12:09:20
I am trying to write a program which will implement plugin modules. There will be a top-level wxFrame and there will also be custom control in a shared library. I would like to load the controls in the shared library at runtime, instantiate a copy and add it to the top-level wxFrame to be displayed and interacted with.

The idea is similar to using ActiveX components in VB or VC++ programs if anyone is familiar with those.

I am having some problems with WxWindows:

#1 If I want to create buttons, cumboboxes, etc... they all need a parent frame to get added to. So I tried creating a class based on wxFrame (which I called TopFrame) and added all the controls I want to it. However, there seems to be no way to show a wxFrame within another wxFrame (which doesn't make much sense anyhow). Therefore this solution requires two separate windows to pop up. I got this to work, but this is not what I am trying to do.  I want to have a single wxFrame to show everything in.


#2 I tried creating a class (not based on any WX controls) which includes all the controls and also a pointer to the top wxFrame.  This approach does allow me to display the controls I want on the top wxFrame (add controls to top wxFrame through the pointer), but I can't seem to get the sizers to work this way. Another problem is that I can no longer define events with this approach since my class is not a wxFrame and I don't want to create an event table in the top-level wxFrame since the event defined in the plugin (shared library) will not be known at loadtime.

#3 Following up on #2, I embedded a wxFrame class into the class I created, have it create all the controls, add them to the top wxFrame and also handle the events, however this time since the wxFrame in my class is not in focus, I cannot capture any events even though I can see the controls created.

In short, I need a way to create a "window-like" control that will contain other controls like buttons, treelists, comboboxes, it will remember where all these controls are within it, and it will process their events without depending on its parent wxFrame.  I should be able to instantiate this "window-like" control at run-time just like any other control and add to an existing wxFrame. 

"wxFrame"s in WxWindows are like the "Form"s in VB.  If it makes it any easier, I am looking for the equivalent of VB's "Frame" control in WxWindows. So far it seems like no such thing exists in WxWindows. 

Is what I am trying to do possible? If yes, any help is appreciated.

Message2. Re: Custom controls implemented as shared library
#2690
Posted by: 2003-09-30 02:10:39

I think I figured it out mostly in case anyone wants to know how.
Message3. Re: Custom controls implemented as shared library
#3232
Posted by: 2004-01-14 12:42:04
Yes I want to know ! can you give me a working example ! I am trying to compile some stuff from MSVC with Dec-Cpp /minGW, but without success

Roberto
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-3-28  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0