Board index » cppbuilder » Z-Order

Z-Order


2005-06-13 08:41:47 AM
cppbuilder46
Can some one please confirm that Screen::Forms preserves the z-order?
Alternatively, can you confirm that Scr{*word*249}::Forms does *not*
preserve the Z-order?
Ultimately, can you tell me how, at any given moment, to be
able to detect the z-order for any given control?
~ JD
 
 

Re:Z-Order

"JD" < XXXX@XXXXX.COM >wrote:
Quote

Got what I wanted using win32 API's GetTopWindow and
GetNextWindow.
~ JD
 

Re:Z-Order

"JD" < XXXX@XXXXX.COM >wrote:
Quote

"JD" < XXXX@XXXXX.COM >wrote:
>

Got what I wanted using win32 API's GetTopWindow and
GetNextWindow.
Well ... not exactly. The original post is still open.
~ JD
 

{smallsort}

Re:Z-Order

Hi,
I've been developing a kind of drawing utility.
The objects are linked to each other through a linked-list.
Each object has a member of (TBitmap *).
struct Node
{
int X, Y;
Graphics::TBitmap() *pBitmap;
Node *next;
};
Assume 100 objects are displayed on the form and they are displayed
throug a loop, for example:
for(i = 0; i < 100; i++, n=n->next)
Canvas->Draw(n->X, n->Y, n->pBitmap);
I'd like to exchange the display order of 6th end 7th objects. I can do it
simply by
modifying the linked list(exchanging 6th and 7th objects) and execute
another
for(i = 0; i < 100; i++, n=n->next)
Canvas->Draw(n->X, n->Y, n->pBitmap);
I guess, this is time-consuming and I'm planning to replace the (TBitmap *)
member with (TImage *).
So, instead of drawing 100 objects every time, it may be better to create
the (TImage *) members once:
n->pImage = new TImage(this);
n->pImage->Left = 0;
n->pImage->Top = 0;
and let Windows handle displaying them.
Again, I'd like to exchange the display order of 6th and 7th objects. I know
how to use
TControl::BringToFront() and TControl::SendToBack() methods. So, exchanging
the display order is:
7->SendToBack();
5->SendToBack();
4->SendToBack();
3->SendToBack();
2->SendToBack();
1->SendToBack();
Using SendToBack() is quite fast:
TImage *im, im2;
...
for(int i = 0; i < 100000; i++)
{
im->SendToBack();
im2->SendToBack();
}
is executed only in ~850msec on my computer.
Is it the recommended way or is there a better way(Exchange(6, 7) ?, or a
low-level Win API function)
Thanks...
 

Re:Z-Order

Hi UO
You should realy have a look at the STL containers
They will make Your life a lot easier, not to mention
safer.
either std::vector or std::list
in this case
Kind regards
Asger