On May 02, 2007, at 13:03 UTC, Narinder Chandi wrote:
> Basically, I have an application property that specifies the build
> type - Server or Client which essentially controls the window shown
> to the user at launch time. Lets call this property prBuildType.
Do you actually see this in the Properties list when you select your
Application subclass in the project tab? I wouldn't expect you to. I
don't think there is any support for specifying default property values
for the magic App subclass. (Though it wouldn't be an outrageous
feature request.)
> In my build script I want to set its value which I think I should be
> able to do with :
>
> PropertyValue("App.prBuildType")="Server"
No, I wouldn't expect that to work. App is a global function which
returns an instance of your Application subclass, at runtime. It
doesn't have any meaning in the IDE. App is also the default name of
that subclass, and may be the actual name of yours, if you haven't
changed it. That has *some* meaning in the IDE, but not much.
Properties in general have values at runtime, not at design time. The
exception to this is design-time property values shown in the
Properties list in the IDE. But prBuildType is not one of those.
> Putting the property in one of my own classes (which is where I would
> prefer it be anyway) doens't work either, e.g.
>
> PropertyValue("MyClass.prBuildType")="Server"
Right, again, you've defined a named memory location to hold a value at
runtime, but you haven't made a new design-time property. I'm not even
sure what this would mean in the case of a class. Which instance of
MyClass should be getting the value "Server" in its prBuildType
property?
> Trying to expose the prBuildType in the IDE using the 'Property List
> Behaviour...' IDE contextual menu doesn't work for me (i.e. I can't
> get the property to display in the Property Editor), so I can't use
> that option to see if it will work then in the IDE script.
Right, if that worked, then the IDE script would probably work. But it
doesn't; "Property List Behavior" is for classes (often control
subclasses) which will be added to a window. That makes a specific
instance, and so you can then set property values for that instance.
> Does anyone have any thoughts?
Well, you need to abandon this idea of making new design-time
properties which you'll assign values to from the IDE Script. Let's
step back a bit. What are you trying to accomplish?
I gather that you want some code to do different things based on
whether the app is a server or a client. You don't need this to be
compile-time differentiation, or you would be using a constant instead
of a property. So anything you can check at runtime will do. But a
constant would also be fine, I assume.
Hmm. One approach would be to have a module whose only job is to
define an "application type" constant. You would have two versions of
this module, stored on disk, defining the two different values. Your
script can delete the previous one from the project, then import the
correct one, before doing the build. Or, more simply, keep both
modules in your project, but have your script rename them so that your
code looks at one and ignores the other.
HTH,
- Joe
>
>
> Regards,
>
> Narinder.
> --
>
> ___________________________________________
> | Narinder Chandi,
> | ToolBox Systems Limited,
> | Surrey, England, UK.
> | http://www.toolbox.uk.com
> |___________________________________________
> | Consultancy * Development * Support
> | * REALbasic Developer Program Member *
> |___________________________________________
>
>
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
>
--
Joe Strout -- [EMAIL PROTECTED]
Strout Custom Solutions
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>