On Sat, Aug 6, 2011 at 12:12 PM, Oliver Sims
<[email protected]> wrote:
> I have a simple "About" dialog in Exercise05 of the Guide.
> In its initDialog method are the following statements:
>
> id = self~constDir[IDB_PROD_ICON]
> image = resImage~getImage(id)
>
> I also issue the following in a class method of a different class
> (ProductView) in the same .rex file:
>
> .application~useGlobalConstDir("O", "ProductView.h")
>
> It all works.
As it should. <grin> This is meant to be fairly transparent to the
user (the programmer) of ooDialog.
> So I assume that the About dialog's constDir attribute is in some way
> connected to
> the new globalConstDir. Is this correct? Maybe under the covers
> globalConstDir just effectively replaces the dialog's constDir?
That's essentially correct. The use of the .constDir is meant to have
as little impact to existing programs as possible. So, if you already
had an application, with a lot of dialogs, and a lot of code, that
used symbolic IDs, and you wanted to have the program use the more
efficient global .constDir, you could just add the single line of
code:
.application~useGlobalConstDir("O", "xxx")
to the program. The rest of the code you could leave alone.
Although really, for the user of the ooDialog framework, how the
internal implementation is done should not be a concern. The internal
implementation can change.
constDir is an attribute of the .PlainBaseDialog. Without the global
.constDir, each time a new dialog is instantiated, a new .Directory
object is instantiated, populated with items, and assigned to the
attribute.
When the usage of the global .constDir is set to ONLY:
.application~useGlobalConstDir("ONLY", ..)
then when a new .PlainBaseDialog is instantiated, the constDir
attribute is simply set to the global .constDir.
>Or if not
> found in constDir then a lookup of globalConstDir is done?
No, that would only happen if you set the usage of the global .constDir to LAST:
.application~useGlobalConstDir("LAST", "xxx")
In this case, the .PlainBaseDialog's constDir is set to a new
.Directory object and populated as usual. In this case, the constDir
attribute's directory object is searched first, then the global
.constDir.
By the way, in your program there is no need to do this:
> id = self~constDir[IDB_PROD_ICON]
> image = resImage~getImage(id)
That is exactly what the gobal .constDir is designed to eliminate.
The code should be:
> image = resImage~getImage(IDB_PROD_ICON)
--
Mark Miesfeld
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users