#572 ooDialog can create wrong object type for controls

ooDialog.4.2.0
closed
Mark Miesfeld
ooDialog (58)
5
2012-08-27
2009-01-24
Mark Miesfeld
No

This is intended for a post-4.0.0 fix.

The way the ooDialog code is structured makes it easy to create the wrong ooDialog class instance for dialog controls.

An ooDialog dialog control object is created from the resource ID and what the programmer says the object is. For instance:

rb = self~getRadioControl(400)

to get a RadioButton object.

But, if the 400 ID is actually the ID of say, a list-view control, then we end up with an object that has the methods of a RadioButton object, but actually maps to list-view control. This causes incorrect results for most method invocations on the object, to say the least.

ooDialog already has the paradigm of returning .nil for a request to 'get' some type of control when the request is made before the underlying dialog has been created. With the new APIs this can be easily extended to check that the underlying dialog control will actually map to the ooDialog object requested. Return .nil if it doesn't.

Discussion

  • Mark Miesfeld
    Mark Miesfeld
    2009-07-14

    Committed revision 4913.

    Moved all of the 'getControl' logic of the AdvancedControls class into a native API method. That way, the code has access to the real type of the underlying Window control If the actual type does not match the requested type, then .nil is returned. This is logically the same as the user requesting a control with an invalid resource ID.

     
  • Mark Miesfeld
    Mark Miesfeld
    2010-09-08

    This fix will be in the next major release of ooDialog, but not in the ooRexx 4.1.0 release.

     
  • Mark Miesfeld
    Mark Miesfeld
    2012-02-03

    This fix will appear in the next major release of ooDialog, it will not be included in an ooRexx bug fix release

     


Anonymous


Cancel   Add attachments