Solved

Popup on Form

Posted on 2010-08-29
6
688 Views
Last Modified: 2012-06-27
Hi,

Is there any way to place a popup (Define Popup) on Form?

Thanks!
SP
0
Comment
Question by:Nick Sui
  • 4
6 Comments
 
LVL 35

Author Comment

by:Nick Sui
ID: 33554006
I use below code in form init but popup does not activate!


      PROCEDURE init
                THIS.DefineMenu
      ENDPROC
      PROCEDURE definemenu       
            DEFINE POPUP shortcut SHORTCUT RELATIVE IN WINDOW (thisform.Name)
                  Define bar 1 of Shortcut Prompt "Item 1"
                  Define bar 2 of Shortcut Prompt "Item 2"
                  Define bar 3 of Shortcut Prompt "Item 3"
            ACTIVATE Popup Shortcut NOWAIT
      ENDPROC
0
 
LVL 35

Author Comment

by:Nick Sui
ID: 33554042
Solved
0
 
LVL 35

Author Comment

by:Nick Sui
ID: 33554056
still unresolved :(
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 250 total points
ID: 33554158
WINDOW (Thisform.name) will not work reliably. Form.Name is not to be confused with a window name. Forms and Windows are in general two seperate collections, windows are only supported for backward compatibility.

What works is
o = CreateObject("form")
o.Name="win1"
Show Window win1

But adding a second form with same name is possible

o2 = CreateObject("form")
o2.Name="win1"

So a window name is not reliable. Skip the Window clause and the popup is within the current active form. In fact define popup is a rather outdated way to create a popup menu and foxpro got no real menu classes comparable to forms.

Popups are context menus and not controls. You typically activate them at right click, not at the start/init of a form, rather use a secondary form, if you want more than a context menu and call that in form.show() when that method runs for the first time.

Rather use the oop menu project from vfpx at codeplex or perhaps try the menu generator of foxpro, in the "Other" tab of the project manager create a new menu, choose a shortcut and then create the items. While in the menu designer choose "Generate" from the menu menu to create an MPR, which is program code to define a popup menu.

A very simplistic result of this comarable to your first try then is:

DEFINE POPUP shortcut SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR 1 OF shortcut PROMPT "item1"
DEFINE BAR 2 OF shortcut PROMPT "item2"

ACTIVATE POPUP shortcut

This creates the popup/shortcut/context menu at the mouse position.

Bye, Olaf.
0
 
LVL 41

Assisted Solution

by:pcelba
pcelba earned 250 total points
ID: 33554365
You may display any popup in a Combo on any form:
DEFINE POPUP shortcutX

Define bar 1 of ShortcutX Prompt "Item 1" 

Define bar 2 of ShortcutX Prompt "Item 2"

Define bar 3 of ShortcutX Prompt "Item 3"



frmMyForm = CREATEOBJECT('Form')



frmMyForm.Width  = 450

frmMyForm.Height   = 100

frmMyForm.Caption  = "Popup Example"

frmMyForm.AutoCenter =.T.

frmMyForm.AddObject("cmdClose","cmdCloseButton")

frmMyForm.AddObject("CmbPopup","cmbPopupCombo")

frmMyForm.SHOW       && Display the form

READ EVENTS        && Start event processing



RELEASE POPUP shortcutX



DEFINE CLASS cmbPopupCombo AS ComboBox

  Left   = 10    && Left edge of button

  Top    = 10     && Position for top of button

  Height   = 20     && Button height

  RowSourceType = 9

  RowSource = 'shortcutX'

  Visible  = .T.    && Show button on form

  

  PROCEDURE Valid

    WAIT WINDOW THIS.Value + " selected" TIMEOUT 0.5

ENDDEFINE



DEFINE CLASS cmdCloseButton AS CommandButton 

  Caption  = "\<Close"   && Caption on command button

  Left   = 175    && Left edge of button

  Top    = 60     && Position for top of button

  Height   = 25     && Button height

  Visible  = .T.    && Show button on form

  FontItalic = .T.    && Turn on italic text

  ForeColor  = RGB(0,0,255) && Change button text color

  PROCEDURE Click

  CLEAR EVENTS     && Stop event processing

ENDDEFINE

Open in new window

0
 
LVL 35

Author Closing Comment

by:Nick Sui
ID: 33736756
Thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now