Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Visibility of objects.
Visibility of objects. [message #28752] Wed, 15 September 2010 13:10 Go to next message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
Hi,

Please, review the attached code. How can I make the two GLCtrls “visible” each other with the current arrangement of header and cpp files? For example, I can control the output in the arrays when a click is made in the GLCtrls; this is easy. But in the case of two user made classes, how can I achieve that?

Cheers,

Javier
Re: Visibility of objects. [message #28761 is a reply to message #28752] Wed, 15 September 2010 20:50 Go to previous messageGo to next message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
No volunteers? No matter; it’s just a simple C++ related query (perhaps it should be posted in the corresponding forum) and not strictly a U++ related query.

Doubt solved, anyhow.

Cheers,

Javier.
Re: Visibility of objects. [message #28763 is a reply to message #28761] Wed, 15 September 2010 22:15 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Please be more specific, take smallest possible piece of code and post here this code and your problem.
Re: Visibility of objects. [message #28784 is a reply to message #28763] Thu, 16 September 2010 16:48 Go to previous messageGo to next message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
Actually it is a question related to C++: if you have different classes, each of them with their .h and .cpp files, how to make them “visible” each other. I have implemented pointers, to point each other. Instead of cross-include their .h files, I have included a forward class declaration; in their .cpp I have cross-included the .h file.

I have no idea whether there are better/more elegant/efficient ways to do it. Any thought?

Cheers,

Javier
Re: Visibility of objects. [message #28786 is a reply to message #28784] Thu, 16 September 2010 18:26 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
The better way to do it is make it so they don't have to see each other at all. I'm guessing you probably want something like a MVC pattern, with the GLCtrls sending their events to a central class that modifies the data-model and then tells the GLCtrls (registered with in some fashion) to refresh themselves.
Re: Visibility of objects. [message #28799 is a reply to message #28786] Fri, 17 September 2010 10:14 Go to previous message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
I think that what you are suggesting is more suitable for multi-user applications. In my case things are simpler. There are few messages that one GLctrl has to pass the other GLCtrl (views), being Refresh() the most important one. So far I do not see the actual benefit of a more complex configuration.

Accessibility to the geometrical model is simple for I have declared it global (so far the model consist on points and lines in 3D, so I am using simple structs with few variable and Vectors to storage and manipulation). This is fine, for the time being.

With a single central GLCtrl this works fine. But when I implement several views with Docking, things change:

1.- depiction of the geom. in different views as it is being created in the central view is ok and straight forward. It woks fine.

2.- rotation and pan of views is ok.

3.- Zoom with associated window: problems. This works fine for the central view. But when I try to make a zoom (this requires the dynamic drawing of a zoom-window) on a secondary view, sometimes do work, others don’t, without apparent reason. It is weird to see, that when a view is docked in top position, it works, whereas when it is relocated in bottom position, it doesn’t. When it is floating, it works. I have spotted that, in some cases, Paint() function is not called correctly, for a reason that escapes to me. Paint() function is supposed to be called continuously, but when you have several views, how does it work?

4.- The auto-hide does not work. The auto-hide view destroys its hRC and then calls its Resize function, but with the central GLCtrl being the current hRC. Then glviewport function is directed toward the central GLCtrl, causing a deformation in the geometrical model. Ok, I shall not use it.

5.- Another alien thing is the behaviour of Key function for views. For example, when a view is floating (supposedly it is a new TopWindow, in addition to the main TopWindow), its Key method does not work, even if the view has the focus (i.e. it has been clicked). No idea why.

Although Docking is superb, it is evident that to work with Docking and several GLCtrls is not that simple. Also the lack of multithreading penalizes the combination of these features. Perhaps when Docking was not designed taking this scenario into account.

Please, if you have hints let me know them.

Many thanks.

Cheers,

Javier
Previous Topic: GLCtrl and Docking: do they work together as expected?
Next Topic: Debugger: access to global variables.
Goto Forum:
  


Current Time: Thu Mar 28 16:31:49 CET 2024

Total time taken to generate the page: 0.01099 seconds