On Fri, Jan 27, 2012 at 9:24 AM, Oliver Sims <
oliver.s...@simsassociates.co.uk> wrote:

> **
> I have a dialog in the centre of the screen. Some user action causes a
> second dialog to open. It opens over the first dialog.
> The user has to move the second dialog in order to see the first.
>
> I'd like to be able to have the second dialog surface offset by some
> stated amount from the first.
>
> I could do this with ~moveTo() or maybe ~moveWindow(). But in both cases
> I'd need to check where on the screen the first dialog is so that the
> second is not half-off or wholly off the screen. To do this would take a
> bit of work: check screen size, check dialog1 position, then work out where
> to bring up the second window - above, below, left, right, or some
> combination such as "to the upper left".
>
> Is there a simple way to surface a dialog so that it's offset by some
> defined amount, but where ooDialog or Windows provides a default new
> position - i.e. to the right, left, top, or bottom of the first dialog?
>
>
>


Hi Oliver,

Originally I said no there was not a simpler way to do this, other than to
do the calculations.  There actually is a relatively simple way to do it by
using the ensureVisible() method of the dialog object.

Here's a code snippet that shows the basic steps.  You will just need to
adapt how you pass the position of the parent to the the second dialog.  Or
create the second dialog hidden, then position and show it from the first
dialog:


  -- Get the parent dialog position:
  pos = self~getRealPos

...
  -- The 'pos' object was passed in
  -- to this dialog as 'parentPos'

  parentPos~incr(20, 30)
  self~moveTo(parentPos, 'SHOWWINDOW')
  self~ensureVisible

The ensureVisible() accesses a Windows API that moves the dialog so that it
is completely with in the screen, but only moves the dialog if needed.  The
above code is designed to put the second dialog over the first dialog,
which is what I wanted.  You can changed the ~incr(...) numbers to instead
move the second dialog further from the parent position.

Write a test program and see if that is sufficient for you.  The thing is,
you do not have 100% control of where the second dialog is placed, but I
think where the operating system places is will be good enough.  If you are
not satisfied with how the OS places the second dialog, then you will need
to do the calculations and placement as you outlined.

--
Mark Miesfeld
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to