On Tue, Jan 10, 2012 at 8:46 AM, Oliver Sims <
[email protected]> wrote:

> **
> Thanks, Mark. That makes sense to me. But off-hand, I can't think of any
> way of doing this in "pure" oorexx. I would guess you actually make the
> swap (as it were) in your C++ code?
>
>

Well, it's true that the transformation is done in the C++ code, but not
true that it can not be done in ooRexx code.  For this method,
mapWindowPoints(), it is done in the C++ code because the Windows API
provides a function that does the mapping for you.

Here is something similar in Rexx:

r = .Rect~new(10, 10, 30, 30)
say 'Rectangle r before:' r

if \ doubleRect(r) then do
  say "Failed to double the rectangle"
  return 1
end

say 'Rectangle r after:' r

return 0

::requires 'ooDialog.cls'  -- For the .Rect class

::routine doubleRect public
  use strict arg rect

  if \ rect~isA(.Rect) then return .false

  width = rect~right - rect~left
  height = rect~bottom - rect~ top

  width *= 2
  height *= 2

  rect~right = rect~left + width
  rect~bottom = rect~top + height

  return .true
Output:

Rectangle r before: a Rect (10, 10, 30, 30)
Rectangle r after: a Rect (10, 10, 50, 50)

The mapWindowPoints() method could be written entirely in Rexx.  It would
just have to do a lot of calculation that the Windows API does for you.

--
Mark Miesfeld
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to