Wow! Many thanks indeed, Mark. Pls ignore my last email (it crossed with
your email).
 
Atb,
Oliver

  _____  

From: Mark Miesfeld [mailto:miesf...@gmail.com] 
Sent: 29 September 2011 17:00
To: Open Object Rexx Users
Subject: Re: [Oorexx-users] Dialog does not open with correct size.


Okay Oliver, I see the problem and have a fix for it.
 
The explanation is a little long-winded, but I figure if people want to
understand how things work in ooDialog, they need to read a little.
 
The dialog uses DlgAreaU.  For your set up, to use DlgAreaU, the size of the
list view is specified as a percentage of the size of the dialog.  But
really dialog controls are sized and placed relative to the *client* area of
the dialog window.  Normally this works fine because the client area of the
window is relative to the over-all size of the dialog.
 
However, when a menu is added to a dialog, the OS keeps the dialog size
(,and indirectly the client area size,) unchanged.  The OS places the menu
at the top of the client area and adjusts all dialog controls down the
height of the menu.
 
So, one of my suggestions, make the dialog 10 units higher, does not work
here because DlgAreaU just increases the list view height.  It is working
with a percentage of the dialog size and doesn't know about the change in
client area due to using a menu.
 
Moving the connect for the size event to the end of initDialog() also does
not work because things are initially positioned by DlgArea (DlgAreaU is a
subclass of DlgArea) using the percentages.
 
So, a first cut at fixing this is to resize the dialog in initDialog() and
take into account the menu.  Something like this:
 
    -- Restrict the minimum width and minimum height
    -- to the original width and height
    minWidth = self~pixelCX
    minHeight = self~pixelCY
 
    -- Get the actual size of the dialog in pixels.
    s = self~getRealSize
 
    -- Resize the dialog to accomadate the menu.
    s~height += 18
    self~resizeTo(s)

When you try this, it looks pretty good.  The controls are all visible in
the proper places.  If the user drags the sizing border on the dialog
everything looks good.
 
But, if the user just clicks on the sizing border, you see the controls
slightly reposition themselves.  Acceptable, but no ideal.
 
A better, but more involved fix is this:  Figure out exactly how high the
menu bar is.  Adjust the size of the dialog to exactly what is needed.
Manually call the onResizeEnded() method to have everything set up
correctly.  The code looks like this:
 
  -- Restrict the minimum width and minimum height to
  -- the original width and height
  minWidth = self~pixelCX
  minHeight = self~pixelCY
 
  -- Get the height of a single line menu bar in pixels.
  -- You can just use the number 15 directly.  I usually
  -- set a variable to the number so I can remember what
  -- I'm doing.
  SM_CYMENU = 15
  height = .DlgUtil~getSystemMetrics(SM_CYMENU)
 
  -- Get the actual size of the dialog in pixels.
  s = self~getRealSize
 
  lastSizeInfo = .DlgUtil~makeLParam(s~width, s~height)
  sizing = .true
 
  s~height += height
  self~resizeTo(s)
  self~onSizeMoveEnded

This works extremely well.  The dialog appears looking correct.  If the user
resizes it, it works as expected.  If the user very carefully clicks on the
resizing border without dragging it, there is no flicker, no repositioning
of the controls.
 
A couple of details about the above code  lastSizeInfo and sizing are
exposed variables used to help with the resizable dialog.  They need to be
added to the expose list in initDialog().
 
The size returned by getRealSize() is actually the same as pixelCX and
pixelCY, so you could change the code to this:
 
  SM_CYMENU = 15
  height = .DlgUtil~getSystemMetrics(SM_CYMENU)
 
  -- Get a size object in pixels for the size we want
  -- the dialog to be.
  s = .Size~new(self~pixelCX, self~pixelCY + height)
  lastSizeInfo = .DlgUtil~makeLParam(s~width, s~height)
  sizing = .true
 
  self~resizeTo(s)
  self~onSizeMoveEnded

--
Mark Miesfeld

On Thu, Sep 29, 2011 at 6:35 AM, Oliver Sims
<oliver.s...@simsassociates.co.uk> wrote:


In the User Guide's Exercise06, the Order Management dialog opens with the
two pushbuttons at the bottom of the dialog window only half visible. When I
click on the window border (no re-size - just a click) the ListView above
the buttons becomes less tall, and the button become fully visible.

I can't find a way of either getting the correct size of listview to appear,
or of emulating in code the click on the border to make the lisview shrink
to its proper starting size.

Btw, the dialog is re-sizeable and uses DlgArea and DlgAreaU.

Any thoughts?

--Oliver






----------------------------------------------------------------------------
--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users




------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to