List Info

Thread: Best practices for controlling externally created windows




Best practices for controlling externally created windows
user name
2007-10-23 14:50:50

Hi,
First, I would like to know the definition of a 'foreign' control.
Please enlighten me. In the DB reference pages (which are quickly
becoming my best friend), the definition of a 'foreign' control is
";similar to a custom control, but you have to type in the class name
each time..." The definition of a 'custom' control is "definitions
for foreign controls implemented externally." I think the 'external'
part of this definition will help me, but I am not entirely sure
because these definitions seem to overlap.

My problem:
I am trying to render 3D graphics within child elements of one or more
wxWindows. However, I don't want my questions to sound specific to
graphics, but rather specific to controlling the size and position of
_any_ window created by a 3rd party library from a wxApp.

Particulars:
- I want the graphics window to be limited by the size of a parent
element or sizer.
- The (graphics) library uses native win32 calls, and accepts (among
others) parameters for parent window and the application instance.

I would like to understand, in general (not specific to 3D graphics),
how one controls the size and position of windows created by external
libraries, so that I can correctly define a GUI layout using DB. What
parameters does the 3rd party library need to use in its native win32
calls? What classes does wxWidgets offer to help me to provide those
parameters? Which classes should my DB project use when generating
code for C++ (not XRC)?

Thanks!
John

__._,_.___
.

__,_._,___
Re: Best practices for controlling externally created windows
user name
2007-10-23 18:55:41

Hi, John!

>-- On Tue, 23 Oct 2007 19:50:50 -0000 john grant wrote --
> Hi,
> First, I would like to know the definition of a 'foreign' control.
> Please enlighten me. In the DB reference pages (which are
> quickly becoming my best friend), the definition of a 'foreign'
> control is "similar to a custom control, but you have to type in
> the class name each time..." The definition of a 'custom' control
> is "definitions for foreign controls implemented externally." I
> think the 'external' part of this definition will help me, but I am
> not entirely sure because these definitions seem to overlap.

Yes... The waters there are a bit murky!;)

My own "definition"; serves me well, but it's purely empirical.

Foreign is typically used to refer to classes (not necessarily wxWidget) that
describe a graphic element (most commonly, a window of some sort).

Custom Control is typically used to refer to classes for control elements (i.e.,
non-windows or non-containers)

In essence they are the same thing, the differentiation lies in the question: Is
it a window:

1) If yes, then it's a foreign window (usually externally implemented), i.e. an
element that "contains" other elements (which may or may not have other child
windows that are also foreign).

2) If no, then it's a control, that is some type of user interface. It may also
be externally implemented.

A purely DB differentiation is the you may define a Custom Control in Settings
under (yes, you guessed it!;) "Custom Control".

>
>
> My problem:
> I am trying to render 3D graphics within child elements of one or
> more wxWindows. However, I don't want my questions to sound
> specific to graphics, but rather specific to controlling the size
>; and position of _any_ window created by a 3rd party library from a
> wxApp.
>
> Particulars:
> - I want the graphics window to be limited by the size of a parent
> element or sizer.
> - The (graphics) library uses native win32 calls, and accepts
> (among others) parameters for parent window and the application
> instance.
>
>
> I would like to understand, in general (not specific to 3D
> graphics), how one controls the size and position of windows
> created by external libraries, so that I can correctly define a GUI
> layout using DB. What parameters does the 3rd party library need
>; to use in its native win32 calls? What classes does wxWidgets
> offer to help me to provide those parameters? Which classes should
> my DB project use when generating code for C++ (not XRC)?
>

DB uses mostly Windows native elements (window or control). For most cases, this
works well. However, if you're wanting to get messages or events that wxWidgets
doesn't know about, that message/event does not get propagated to the relevant
code. So, you must short circuit this by building your own class that recognizes
the message/event in question. The problem is determining which wxWidgets
element from which you'd like to build your derived class. A typical choice for
images is wxScrolledWindow.

Bottom line is, if you want the message/event to reach your code, you must
include a class that is derived from wxWidgets (wxWindow, for example). Your
class augments your chosen wxWidgets element, letting the parent class handle
generic message processing and processing your own unique code needs.

It sounds quite involved, I know, but once you've done one, you generally see
that it's actually quite simple: Use the parent class' code to process all
"generic"; messages/events. Override/add functions within your derived class to
handle the "non-generic" messages/events.

> Thanks!
> John
>;
>
> Yahoo! Groups Links

thx,
Dave S.

Contrary to popular belief, practice does not make perfect... only permanent!

wxMS_developers · Development with wxWidgets on MSWindows
http://tech.groups.yahoo.com/group/wxMS_developers/

wxWidgets Code Exchange
http://www.wxCodex.net/

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )