Results 1 to 10 of 10

Thread: Popup Forms

  1. #1
    Member
    Real Name
    Daryl Grace
    Join Date
    Apr 2000
    Location
    Hopkinsville, KY
    Posts
    162

    Default Popup Forms

    How do I center a popup form on the screen?

    Thanks,
    Daryl

  2. #2
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,281

    Default RE: Popup Forms

    Daryl,

    Not sure I remember how I did it but will verify it tomorrow. In the pop up window's properties, there are settings for form location. So many " east, west, north, south. Well, it doesn't say E,W,N,S but you get the idea.

    kenn

  3. #3
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,281

    Default RE: Popup Forms

    Daryl,

    Go to the Properties for the pop-up form, click Window and at the top you'll see settings for the side and top. Try settig each one at 3 and see where that puts it.

    kenn

  4. #4
    Member
    Real Name
    Tom Lyon
    Join Date
    Apr 2000
    Posts
    610

    Default RE: Popup Forms

    There are ways to do it that might be simpler, but because of different screen resolutions, I believe more accurate results can be obtained with this bit of code:

    f = form.view("OneOfYourForms", "Popup")
    screenX = ui_info(0)
    screenY = ui_info(1)
    formX = f.width
    formY = f.height
    x = (screenX - formX) / 2
    y = (screenY - formY) / 2
    f.left = x
    f.top = y

    Tom Lyon

  5. #5
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,281

    Default RE: Popup Forms

    Tom,

    Does this automaticly place it in the center no mater what the screen size? Also, if the pop-up location were to be on the side and lower, how would you handle that?

    kenn

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    22,811

    Default RE: Popup Forms

    x = (screenX - formX) / 2
    y = (screenY - formY) / 2

    Dividing the total available screen width and height by two centers the form. If you wanted to have it lower and "righter" you would make the divisor smaller, resulting in a higher starting position.

    x = (screenX - formX) / 1.5 (or such)
    y = (screenY - formY) / 1.5 (or such)

    If you lower the divisor to 1, the form would be placed at farthest right and bottom position, likely off the screen.

    The opposite would be true for higher and "lefter".

  7. #7
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default RE: Popup Forms

    Unfortunately due to an anamoly in A5 (read as bug), A5 code can not seem to properly move a box (pop-up for sure) from which it is invoked. In other words, placing the centering code in an OnInit or OnActivate event will not properly be able to move itself. The code that opens the window, however, can move it.

    Also, the positon of A5's main window (the whole thing) is given in inches. If you want to center within that window, you must divide by 96 (dots per inch) for most systems. Also you may want to check if any of the window you are displaying would be off screen and adjust accordingly. If you center to an A5 window, and the window is mostly off screen, it is possible to have a pop-up box that you can not see and can not click on or even move.

    Regards,

    Ira J. Perlow
    Computer Systems Design & Associates
    csda@mediaone.net

  8. #8
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,281

    Default RE: Popup Forms

    Stan,

    Thanks. Goses to show there is always more than one way to do something. I thought Ira's comments to be interesting as well. Thanks Ira.

    kenn

  9. #9
    Member
    Real Name
    Tom Lyon
    Join Date
    Apr 2000
    Posts
    610

    Default RE: Popup Forms

    Yes, it does. But, as Ira points out below, the script must be invoked from a form other than the popup form. This is done in the sample script above.

    Stan beat me to your alternate positioning question below.

    The ui_info() command reads the current screen resolution.

    Hidden forms could be interesting :) One might be able to type into them if using a script to give focus to the hidden form. No idea what use it could be, except maybe venting frustration where no one could see it :)

    Hmmm..maybe one could create a virtual desktop within Alpha Five?

    Tom Lyon

  10. #10
    Member
    Real Name
    Daryl Grace
    Join Date
    Apr 2000
    Location
    Hopkinsville, KY
    Posts
    162

    Default RE: Popup Forms

    Thanks for everyone's input. I will give it a try.

    Thanks,
    Daryl

Similar Threads

  1. UDF popup help
    By Bill Parker in forum Alpha Five Version 7
    Replies: 3
    Last Post: 10-14-2005, 12:44 AM
  2. Using popup calculator
    By Rick Valenzuela in forum Alpha Five Version 5
    Replies: 5
    Last Post: 10-01-2003, 03:23 AM
  3. RTF = POPUP editor
    By Cooper Collier in forum Alpha Five Version 5
    Replies: 3
    Last Post: 09-26-2003, 09:23 PM
  4. Auto popup doesn't
    By CALocklin in forum Alpha Five Version 5
    Replies: 1
    Last Post: 12-11-2002, 01:08 PM
  5. Key to pop a popup
    By Greg Fong in forum Alpha Five Version 4
    Replies: 2
    Last Post: 04-03-2002, 04:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •