` Printed Icetips Article

Icetips Article



ABC: Declaring popup menus using abc classes
1998-11-11 -- Jim Katz
 
Newsgroups: topspeed.products.c5ee

> I need to create a pop-up menu when the user right-clicks over a text
> box on a form. Are there any good examples available of how to do this?
> I have been looking at the examples APP's that come with C5 but haven't
> seen one yet.


I would do this using the ABC popup Class. In your local data declare an
object of the popup class:

MyPopup    &PopupClass

Then in the Window Manager's Init Method

MyPopup    &= New PopupClass
MyPopup.Init()

Then add the items to the popup to do whatever you need the popup to do.

MyPopup.AddItem('Do Something',DoSomething)

or

MyPopup.AddItemEvent('Do This',Event:MyEvent,)

In the Window Manager's TakeKey method:

If Keycode() = MouseRight
  IF Field() = ?MyTextField
    MyPopup.Ask()
  End
End

Then in the Window Manager's Kill method:

MyPopup.Kill

For more info on the various methods see the Application Handbook.

HTH

--
Jim Katz



Printed November 23, 2024, 6:20 am
This article has been viewed/printed 35397 times.
Google search has resulted in 9 hits on this article since January 25, 2004.