Home > Archive > PowerBuilder > March 2006 > Single list of constants between several Targets
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Single list of constants between several Targets
|
|
| miner49er 2006-02-20, 7:00 pm |
| Hi there,
I have a list of constants that I want to be able to access from
severall different Targets. In VB it's possible to make a module and
share that between projects. Is the same sort of thing possible in
Powerbuilder (I'm using 10 at the moment)?
The closest i've to achieving this is adding the list of constants to
each Targets Global variables list. This is not good enough though, as
I have about 8 targets and if the list of constants changes then that
means lots of work...
Any help would be much appreciated.
Thanks,
bye.
| |
| Maier, Manfred 2006-02-20, 7:00 pm |
| miner49er wrote:
"miner49er" <matholton@yahoo.com> schrieb im Newsbeitrag news:1140447114.619804.36150@g14g2000cwa.googlegroups.com...
> Hi there,
>
> I have a list of constants that I want to be able to access from
> severall different Targets. In VB it's possible to make a module and
> share that between projects. Is the same sort of thing possible in
> Powerbuilder (I'm using 10 at the moment)?
>
> The closest i've to achieving this is adding the list of constants to
> each Targets Global variables list. This is not good enough though, as
> I have about 8 targets and if the list of constants changes then that
> means lots of work...
>
> Any help would be much appreciated.
>
> Thanks,
>
> bye.
>
I'm using Powerbuilder 6.2
you can do this:
1. create a non visual userobject (n_user)
2. declaring the constant's as Instant-Variables of n_user
3. create in the application window of your prgram in the open-event
gnv_user = CREATE n_user
4. in any powerbuilder window you can now acces the constant's
5. the userobject is also useable in any new powerbuilder project
(Copy and Paste)
6. acces example as follows:
as Instant-Variable of n_user object
constant string LS_MYHOME = "San Francisco" (there are the 49er's)
in application open-event
gnv_user = CREATE n_user
in any window
string ls_myhome = gnv_user.LS_MYHOME
7. sorry for my english, i hope it is all clear.
Manfred Maier
N 48° 22' 36,48" --- E 10° 49' 43,17" --- (WGS84)
| |
| Maier, Manfred 2006-02-20, 7:00 pm |
| miner49er wrote:
"miner49er" <matholton@yahoo.com> schrieb im Newsbeitrag news:1140447114.619804.36150@g14g2000cwa.googlegroups.com...
> Hi there,
>
> I have a list of constants that I want to be able to access from
> severall different Targets. In VB it's possible to make a module and
> ------------------------ snip ---------------------------------------------------------------
excuse me, i vergot in my answer:
befor 3. you must delare n_user gnv_user as global variable
sorry
Manfred Maier
N 48° 22' 36,48" --- E 10° 49' 43,17" --- (WGS84)
| |
| miner49er 2006-02-21, 3:57 am |
| Hi Manfred,
Thanks for your help, I shall try that out today.
Allthough I'm slighlty concerned at your suggested use of the object
using Cut n' Paste, as surely that defeats the original objective (to
not have repeated code)?
Thanks again,
Mat
| |
| miner49er 2006-02-21, 7:57 am |
| Sorted, your solution works perfectly. Excellent.
many, many thanks :-)
mat
| |
| Pupochek 2006-02-21, 4:56 pm |
| quote: Originally posted by miner49er
Sorted, your solution works perfectly. Excellent.
many, many thanks :-)
mat
Actually, as you previously mentioned this solution defeats the purpose :-)
First of all, you do NOT need CREATE/DESTROY statements and global/instance declarations for an NVO which just holds constant declarations.
What you need is simple - ONE pbl which holds your NVO (let's call it "nvo_constants") with publicly declared CONSTANTS, which you share between the targets, i.e. it is in the library list of all your targets. Then in any script you just do this:
nvo_constants.MY_CONSTANT_WHATEVER and you have access to it WITHOUT object instantiation. | |
| Philip & Elena Salgannik 2006-02-22, 3:57 am |
| Actually, as you previously mentioned this solution defeats the purpose :-)
First of all, you do NOT need CREATE/DESTROY statements and global/instance
declarations for an NVO which just holds constant declarations.
What you need is simple - ONE pbl which holds your NVO (let's call it "nvo_c
onstants") with publicly declared CONSTANTS, which you share between the tar
gets, i.e. it is in the library list of all your targets. Then in any script
you just do this:
nvo_constants.MY_CONSTANT_WHATEVER and you have access to it WITHOUT object
instantiation.
"miner49er" <matholton@yahoo.com> wrote in message
news:1140520243.132624.182650@g43g2000cwa.googlegroups.com...
> Sorted, your solution works perfectly. Excellent.
>
> many, many thanks :-)
>
> mat
>
| |
|
| You didn't mention if the values needed to be dynamically changeable. The
solution used requires a regeneration of the app(s) for each change of a
variable value.
If dynamic data is required, there's always INI files that can pick up a
variable value (within reason). Then there's database access, which PB does
quite well ;-)
"miner49er" <matholton@yahoo.com> wrote in message
news:1140520243.132624.182650@g43g2000cwa.googlegroups.com...
> Sorted, your solution works perfectly. Excellent.
>
> many, many thanks :-)
>
> mat
>
|
|
|
|
|