Query current pos of GeUserArea/GeDialog [CLOSED]
On 14/11/2014 at 01:01, xxxxxxxx wrote:
Cinema 4D Version: R 13.061
Language(s) : C++ ;
I've implemented a custom data type which uses a GeUserArea to visualize its value. This GeUSerArea is a part of a parent GeDialog which is being shown in the AttributeManager. My implementation needs to know the area which is currently visible (xy-pos, width, height) on the screen. But neither from the GeDIalog nor from the GeUserArea I can managae to find out its current position.
I already tried every way which seems to be promising (based on SDK and the plugincafe forum).
I there a way to query the current position of a GeUserArea/GeDialog ?
On 14/11/2014 at 02:17, xxxxxxxx wrote:
you can 'query' or obtain the various screen-related pixel positions and sizes of gui elements by using GetItemDim(), which is called from your dialog. A bit like the following:
// enum MY_USERAREA_ID // from inside dialog LONG Xx,Yy,Ww,Hh; GetItemDim(MY_USERAREA_ID,&Xx,&Yy,&Ww,&Hh);
I'm still on R14 so if you have a later version you'll need to adjust the LONGs etc. Otherwise, hope that helps!
On 14/11/2014 at 04:36, xxxxxxxx wrote:
Thx for the information but this isn't the information which I'm looking for. GetItemDim( ) returns the position of my GeUserArea relative to its parent GeDialog. The returned width and height are also the ones which have been used during initialization of the GeUserArea.
What I need is the visible area of the GeUserArea. The 'real' position can be calculated by :
LONG lPosX = 0;
LONG lPosY = 0;
Local2Global( &lPosX, &lPosY );
But what I can't get is the information if the GeUserArea is being clipped be when the attribute manager clips the GeDialog.
GeUserArea -> x=0;y=0; w=400;h=200
GeDialog -> x=?,y=?,w=500;h=250
Attribute Manager reduces the GeDialog to 400x150. What are the coordinates , width and height of the dialog?
On 14/11/2014 at 06:09, xxxxxxxx wrote:
can you please describe what you are trying to achieve in the end?
On 14/11/2014 at 07:01, xxxxxxxx wrote:
I've OpenGL overlay window for the GeUserArea which is (nearly) completely independent from the GeUserArea:
Everything is fine except the fact that I cannot determine the clipping coordinates (red lines). Because of the overlay window I'm not able to use the C4D Sdk drawing mechanisms.
On 14/11/2014 at 07:19, xxxxxxxx wrote:
I'm terribly sorry, already feeling a bit stupid, but I need to ask more:
What do you mean by clipping coordinates (red lines)? Which red lines???
In general a GeUserArea does not get clipped. It get's resized to fit into the dialog (and you'll get the new dimensions in Sized()) down to the specified minimum size. But I guess you know that already. If the user shrinks the dialog any further, well then, yes, it does get clipped and shown with scrollbars, but I don't think, there are any means to determine the still visible size.
But maybe I'm talking about completely different stuff here...
On 14/11/2014 at 07:24, xxxxxxxx wrote:
I just added an image (tooked a while to find out how... ) which hopefully explain in a little bit more. If not please let me know...
On 14/11/2014 at 07:29, xxxxxxxx wrote:
The scrollbar at the bottom, is it there, because your GeUserArea's min size is wider than the dialog?
On 14/11/2014 at 07:41, xxxxxxxx wrote:
I'm able to calculate the x and y position by using the _Local2Global( &lPosX = 0, &lPosY = 0 ) _function. This position is used to set the position of the overlay window (checkerboard).
I assumed that GeUserArea ::DrawMsg(LONG x1, LONG y1, LONG x2, LONG y2, const BaseContainer &msg) would give me the right information but this is only true if a complety redrawing happpens. During scrolling operation only the newly apearing area is being drawn while the already visible content seems to be blitted by C4D.
On 14/11/2014 at 08:59, xxxxxxxx wrote:
I'm afraid, what you are trying to achieve is not possible
At least as far as I know, there are no means to get the information you need. In DrawMessage() C4D provides you with means to optimize your drawing (as you already figured out), but in the end C4D handles it completely internally, which parts of the GeUserArea needs to be displayed.
And if I understand correctly you would like to use the GeUserArea only as a placeholder for your overlay, which is drawn completely out of control of C4D.
On 14/11/2014 at 09:30, xxxxxxxx wrote:
Thx a lot for you fast answers.
Either I'll be able to find a 'clever' way to solve this issue or I need to re-think over the UI concept.