On Sun, Jul 3, 2011 at 10:33 AM, Oliver Sims <
oliver.s...@simsassociates.co.uk> wrote:

> **
> I think this got bounced from the list on account of it's more than 40KB.
>


Yes, probably.  It would be better to send just the zip file of the program
to my gmail account, and the message to the list.



>
>  ------------------------------
> *From:* Oliver Sims [mailto:oliver.s...@simsassociates.co.uk] *On Behalf
> Of *os...@simsassociates.co.uk
> *Sent:* 03 July 2011 00:16
> *To:* 'oorexx-users@lists.sourceforge.net'
> *Subject:* RE: [Oorexx-users] Global ConstDir and RcDialog Menu
>
>
> Must be a bug - 'cos my Exercise04a doesn't work any more (it's an
> RcDialog). I had to add the .Application~useGlobalConstDir to make it work.
>

No, not a bug.  You have to use numeric IDs in the *.rc file or ooDialog can
not parse it.  This needs to change also:

IDR_MENU1 MENU
{
    POPUP "Actions"
    {
        MENUITEM "New Customer...", IDM_NEWCUST___1
        MENUITEM "Update...", IDM_UPDATE___1
        MENUITEM "Print...", IDM_PRINT___1
        MENUITEM "Last Order", IDM_XXYYZZ
    }
}

You would need to change that to:

 200 MENU
{
    POPUP "Actions"
    {
        MENUITEM "New Customer...", 210
        MENUITEM "Update...", 220
        MENUITEM "Print...", 230
        MENUITEM "Last Order", 240
    }
}

or some other numbers.


>
> Btw, in the sample app for the Guide, there will be multiple program files,
> each with their own header files. From what you say, it sounds like I won't
> be able to use the GlobalConstDir, as I'll have multiple .h files.
>

No, you will be able to use it.  There will be a method, addToConstDir()
that will allow you to add as many symbols as you want.




>  Unless I've misunderstood, if I invoke two .Application~useGlobalConstDir
> then the second will overwrite the first, and the first set of symbols not
> then be available.
>


No, you misunderstand.  A.) the second does not over-write the first.  B.)
the first set of symbols is still available.  Invoking useGlobalConstDir()
twice is awkward, that is all.  Semantically it doesn't make sense, you
already set how the global constDir is to be used, why would you set how it
is to be used again.




>  Is that correct? The name "GlobalConstDir" sounds like a single constdir
> for all dialog classes in the app.
>


It is.




>  That is, only one .h file. But maybe GlobalConstDir differentiates by .h
> file name (or by some other method)?
>

The .constDir or the dialog objects constDir attribute *do not* have
anything to do with .h file names.  Providing a file name, is simply a way
to add symbols to the .Directory object, implemented by ooDialog.  It is
convenient, for ooDialog, because resource editors in general maintain a
separate file to define symbolic constants.



>
> Btw, I tried two invocations in "startup.rex" as follows :
>    .application~useGlobalConstDir("O", "CustomerView.h")
>   .application~useGlobalConstDir("O", "CustomerView2.h")
> where the second file has a different ID number and symbol for a particular
> menu item than the first.  But the dialog worked OK!
>

Sure it worked.  Adding new, different, indexes to a .Directory object does
not change the existing indexes in the .Directory object.

Since your past Rexx experience is with classic Rexx, perhaps your confusion
comes from not understanding the .Directory class.  It might be a good idea
to review the .Directory class in the Rexx reference.



>  Then I switched numerid IDs in CustomerView2 for two other menu items -
> and it still worked OK.
>

Sure, same explanation as above.


>   This leads me to believe that items are not being over-written - that
> the name of the .h file is significant - i.e. it is used as a sort of stem
> to the symbols in it.
> Is this right?
>


No, its not really right.  As I said, nothing is being over-written, but
file names have nothing to do with this.

You program will work perfectly well, if in Startup.rex, you change this
line:

--.application~useGlobalConstDir("O", "CustomerView.h")

to this:

.application~useGlobalConstDir("O")
.constDir[IDD_DIALOG1] =              100
.constDir[IDR_MENU1] =                101
.constDir[IDC_ERROR_MSG] =            1000
.constDir[IDC_RECORD_CHANGES] =       1001
.constDir[IDM_NEWCUST___1] =          40000
.constDir[IDM_UPDATE___1] =           40001
.constDir[IDM_PRINT___1] =            40002
.constDir[IDC_CUST_ZIP] =             40003
.constDir[IDM_XXYYZZ] =               40003
.constDir[IDC_LAST_ORDER_DETAILS] =   40005
.constDir[IDC_EDIT_CUST_NO] =         40008
.constDir[IDC_EDIT_CUST_NAME] =       40009
.constDir[IDC_EDIT_CUST_ADDR] =       40010
.constDir[IDC_EDIT_CUST_ZIP] =        40011
.constDir[IDC_EDIT_CUST_DISCOUNT] =   40012
.constDir[IDC_LBL_CUST_DISCOUNT] =    40013
.constDir[IDC_LBL_CUST_LAST_ORDER] =  40014
.constDir[IDC_LBL_CUST_ADDR] =        40015
.constDir[IDC_LBL_CUST_NAME] =        40016
.constDir[IDC_LBL_CUST_NO] =          40017
.constDir[IDC_SHOW_LAST_ORDER] =      40028


Again, let me stress, adding symbols to either the global .constDir, or the
dialog object's constDir attribute with a file, is just *one of many* ways
the programmer could choose to add symbols.  It is *a very convenient
way*when a resource editor is used to design the dialogs, because most
resource
editors will maintain the file for you.

By the way, I wrote an example program showing how to use the dialog data
stem.  It will be added to the extra ooDialog samples package.  I hope to
get version 0.0.1 of that package up on SourceForge within a couple of
days.  In the meantime, I'll send you a copy.  If there is someone else who
wants the example right now, just drop me a note.

--
Mark Miesfeld
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to