Board index » cppbuilder » TPopup Visible? if so Visible = false

TPopup Visible? if so Visible = false

I need to some how determine if my Popup menu is showing/in-use and IF SO hide
it..

Any ideas on how I can do this?

*thanx already*

- Tolga
Systems Administrator
Post Time Research
-----------------------------
(   ICQ# 28264566   )

 

Re:TPopup Visible? if so Visible = false


hehehe, that would be nice though wouldn't it ?!
Too bad TPopupMenu neither has a Visible property or a Hide method. :O(

- Tolga
Systems Administrator
Post Time Research
-----------------------------
(   ICQ# 28264566   )

Quote
Alex Szorkovszky <szo...@hotmail.com> wrote in message

news:80ko7m$nb68@forums.borland.com...
Quote
> if (Popup->Visible) {
>     Popup->Hide();
> }

Re:TPopup Visible? if so Visible = false


if (Popup->Visible) {
    Popup->Hide();
Quote
}

Re:TPopup Visible? if so Visible = false


How about something like this, using API calls:

if(IsWindowVisible(Popup->Handle))
    ShowWindow(Popup->Handle, SW_HIDE);

Gambit

Quote
Tolga Balci <administra...@itsposttime.com> wrote in message

news:80kk3t$n8f4@forums.borland.com...
Quote
> I need to some how determine if my Popup menu is showing/in-use and
> IF SO hide it..

Re:TPopup Visible? if so Visible = false


Hi Tolga,

Quote
> I need to some how determine if my Popup menu is
> showing/in-use and IF SO hide it..  
> Any ideas on how I can do this?

You can use the TrackPopupMenu() API function, then the WM_CANCELMODE message to
hide the popup menu.  For example...

void __fastcall TForm1::FormMouseUp(TObject *Sender, TMouseButton Button,
    TShiftState Shift, int X, int Y)
{
    if (Button == mbRight)
    {
        POINT P = ClientToScreen(Point(X, Y));
        PopupMenu1->Tag = true;
        TrackPopupMenu(PopupMenu1->Handle,
                       TPM_LEFTALIGN | TPM_RIGHTBUTTON,
                       P.x, P.y, 0, Handle, NULL);
    }

Quote
}

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
    if (PopupMenu1->Tag)
    {
        SNDMSG(Handle, WM_CANCELMODE, 0, 0);
        PopupMenu1->Tag = false;
    }

Quote
}

Good luck!

--------------------------------------
Damon Chandler

http://bcbcaq.freeservers.com
Answers to <Commonly Asked Questions>
52064929

Re:TPopup Visible? if so Visible = false


Great information !

*thank you*

- Tolga
Systems Administrator
Post Time Research
-----------------------------
(   ICQ# 28264566   )

Other Threads