Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 6511 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, I am currently writing a GUI system with C++Builder and openGL and have it working reasonably well. However my controls descend from TGraphicsControl in order not to paint over the opengl screen. The problem i am having is that i cannot create nested controls ie controls within controls at design time even though i am setting the control style to allow control insertion. Is there a) A way to enable this in decendants of TGraphicsControl or b) A way to stop TCustomControls from painting to the screen (i have tried overriding Paint and PaintWindow) but these seem to have no effect i have also tried setting the canvas brush to style = bsClear and also controlstyle>>csOpaque but with no effect. The only other possible thing I can think of is to Lock the canvas of the GUI form. Many thanks Mark.

Share this post

Link to post
Share on other sites
Do you have to have the control on the same form?

if not what I do is spawn another form that has my controls on and control the openGl form from there.

Also with this method if you have Builder 5 you can create frames so that there on the same form.

Share this post

Link to post
Share on other sites
What i have is a component called GUIForm which
holds my controls this has a show and hide
method which when called the controls are added
or removed from the main gui viewport and are rendered.
in this way they act as usual controls but are rendered
with opengl.
This way they are designed off of the
main form and all code is associated in there
own forms but gets triggered when they are used
on the main form.

Share this post

Link to post
Share on other sites
OMG man that sounds very cool I can''t wait to see these things! Unfortunately I haven''t done enough component creation to help you with your question. Have you looked at the source code for this? You might not have Delphi so I took this from the delphi source

procedure TWinControl.CreateParams(var Params: TCreateParams);
FillChar(Params, SizeOf(Params), 0);
with Params do
Caption := FText;
if csAcceptsControls in ControlStyle then
Style := Style or WS_CLIPCHILDREN;
ExStyle := ExStyle or WS_EX_CONTROLPARENT;
if not (csDesigning in ComponentState) and not Enabled then
Style := Style or WS_DISABLED;
if FTabStop then Style := Style or WS_TABSTOP;
X := FLeft;
Y := FTop;
Width := FWidth;
Height := FHeight;
if Parent <> nil then
WndParent := Parent.GetHandle else
WndParent := FParentWindow;
WindowClass.style := CS_VREDRAW + CS_HREDRAW + CS_DBLCLKS;
WindowClass.lpfnWndProc := @DefWindowProc;
WindowClass.hCursor := LoadCursor(0, IDC_ARROW);
WindowClass.hbrBackground := 0;
WindowClass.hInstance := HInstance;
StrPCopy(WinClassName, ClassName);

This was the only place that csAcceptsControls was used. If you don''t have delphi I can send you the controls.pas unit so that you may be able to duplicate this behavior in the TGraphicControl.

Share this post

Link to post
Share on other sites
yep that works - all except for slight flicker when
showing control - will post a link to website for
downloading nearer completion for anyone thats interested

Cheers all.

Share this post

Link to post
Share on other sites
hmm. I knew I should have looked at the VCL source BEFORE I started my delphiX GUI.
I''ve done it the hard way and duplicated the ability for a TGraphicsControl to host another TGraphicsControl.
If you can read Delphi then the source is @

I''ll be releasing a near total rework of DXInput.pas soon.
Still adding event support to the joystick
I havent touched the forcefeed back code because I dont have a
forcefeed back joystick
The mouse works, and the keyboard is even more powerful.
Full support for window/non-windowed mode with the mouse, exclusive/non-exclusive modes.

Turbo the search box is dead. It doesnt properly display the results(in netscape works in explorer). Have to dig them out of the HTML source.
And can the link for the DXGui V0.05 be updated ...

Share this post

Link to post
Share on other sites
It is described in the help file that a control can contain other controls (be a parent of other controls) if that control descends from TWinControl. TCustomControl descends from TWinControl and provides a virtual Paint method to make it easier to use.

TGraphicControl does not descend from TWinControl. It does not contain a window handle and therefore uses less resources.

Steve ''Sly'' Williams  Code Monkey  Krome Studios

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!