Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How to assign to a variable as reference or make an alias of a control

4 posts in Objects Last posting was on 2009-10-22 09:42:30.0Z
neil Posted on 2009-10-22 07:32:29.0Z
Sender: 6904.4ade7778.1804289383@sybase.com
From: Neil
Newsgroups: sybase.public.powerbuilder.objects
Subject: How to assign to a variable as reference or make an alias of a control
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4ae00a8d.301e.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 22 Oct 2009 00:32:29 -0700
X-Trace: forums-1-dub 1256196749 10.22.241.41 (22 Oct 2009 00:32:29 -0700)
X-Original-Trace: 22 Oct 2009 00:32:29 -0700, 10.22.241.41
Lines: 19
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9938
Article PK: 737066

Hi everyone, I happen to have this structure that is
considerably long. example, I have a control structure like
this:

tab_1.page1.tab_2.page1.tab_3.page1.dw_1

Accessing dw_1 in code would make my code too long. I would
like that in code, I can maybe declare a datawindow variable
(ldw_ref) and assign dw_1 into that variable as reference so
that in code, I may just write it shorter. Instead of
writing, tab_1.page1... until I reached dw_1. repeating that
for all columns of dw_1 is so tedious to write.

All I know is that I can pass it to a function as reference.
But I am not coding in a function. Is there any other way to
achieve the above outside a function?

TIA
Neil


Jeremy Lakeman Posted on 2009-10-22 07:56:31.0Z
From: Jeremy Lakeman <jeremy.lakeman@gmail.com>
Newsgroups: sybase.public.powerbuilder.objects
Subject: Re: How to assign to a variable as reference or make an alias of a control
Date: Thu, 22 Oct 2009 00:56:31 -0700 (PDT)
Organization: http://groups.google.com
Lines: 29
Message-ID: <530b500c-d10b-44de-a82c-ccbd20fdce46@b25g2000prb.googlegroups.com>
References: <4ae00a8d.301e.1681692777@sybase.com>
NNTP-Posting-Host: 219.90.186.150
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1256198191 24299 127.0.0.1 (22 Oct 2009 07:56:31 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 22 Oct 2009 07:56:31 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: b25g2000prb.googlegroups.com; posting-host=219.90.186.150; posting-account=euaBtgoAAAC_vDxfsxmpMKlBxHaHpmRS
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!b25g2000prb.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9939
Article PK: 737065


On Oct 22, 5:32 pm, Neil wrote:
> Hi everyone, I happen to have this structure that is
> considerably long. example, I have a control structure like
> this:
>
> tab_1.page1.tab_2.page1.tab_3.page1.dw_1
>
> Accessing dw_1 in code would make my code too long. I would
> like that in code, I can maybe declare a datawindow variable
> (ldw_ref) and assign dw_1 into that variable as reference so
> that in code, I may just write it shorter. Instead of
> writing, tab_1.page1... until I reached dw_1. repeating that
> for all columns of dw_1 is so tedious to write.
>
> All I know is that I can pass it to a function as reference.
> But I am not coding in a function. Is there any other way to
> achieve the above outside a function?
>
> TIA
> Neil

Yep, just like that.

datawindow ldw_1
ldw_1 = tab_1.page1.tab_2.page1.tab_3.page1.dw_1

ldw_1.retrieve()
...


Ivaylo Ivanov Posted on 2009-10-22 08:19:26.0Z
From: "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com>
Newsgroups: sybase.public.powerbuilder.objects
References: <4ae00a8d.301e.1681692777@sybase.com> <530b500c-d10b-44de-a82c-ccbd20fdce46@b25g2000prb.googlegroups.com>
Subject: Re: How to assign to a variable as reference or make an alias of a control
Lines: 62
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4ae0158e$1@forums-1-dub>
Date: 22 Oct 2009 01:19:26 -0700
X-Trace: forums-1-dub 1256199566 10.22.241.152 (22 Oct 2009 01:19:26 -0700)
X-Original-Trace: 22 Oct 2009 01:19:26 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9940
Article PK: 737068

This technique can be further improved to become a general way of
referencing all the datawindow controls within the form:

1) declare instance array of datawindow type:
datawindow dws[]

2) for each of the datawindow controls within tabpages declare instance
constant to be used as index within the array:
constant integer CI_DW_MAIN = 1
constant integer CI_DW_EDU = 2
constant integer CI_DW_HIST = 3
etc...

3) on window opening prepare the array, just like Jeremy wrote:
dws[CI_DW_MAIN] = tab_1.page1.dw_main
dws[CI_DW_EDU] = tab_1.page1.tab_2.page1.dw_education
dws[CI_DW_HIST] = tab_1.page1.tab_2.page1.tab_3.page1.dw_1
etc.

4) after that, simply use dws[<CI_dw_constant>] to reference the desired
control

And I hope that the example you wrote
"tab_1.page1.tab_2.page1.tab_3.page1.dw_1" is not a real thing - I would
prefer to put meaningful suffixes of the controls instead of the default
numeric ones :-)

Regards,
Ivaylo

"Jeremy Lakeman" <jeremy.lakeman@gmail.com> wrote in message
news:530b500c-d10b-44de-a82c-ccbd20fdce46@b25g2000prb.googlegroups.com...

On Oct 22, 5:32 pm, Neil wrote:
> Hi everyone, I happen to have this structure that is
> considerably long. example, I have a control structure like
> this:
>
> tab_1.page1.tab_2.page1.tab_3.page1.dw_1
>
> Accessing dw_1 in code would make my code too long. I would
> like that in code, I can maybe declare a datawindow variable
> (ldw_ref) and assign dw_1 into that variable as reference so
> that in code, I may just write it shorter. Instead of
> writing, tab_1.page1... until I reached dw_1. repeating that
> for all columns of dw_1 is so tedious to write.
>
> All I know is that I can pass it to a function as reference.
> But I am not coding in a function. Is there any other way to
> achieve the above outside a function?
>
> TIA
> Neil

Yep, just like that.

datawindow ldw_1
ldw_1 = tab_1.page1.tab_2.page1.tab_3.page1.dw_1

ldw_1.retrieve()
...


neil Posted on 2009-10-22 09:42:30.0Z
Sender: 6904.4ade7778.1804289383@sybase.com
From: Neil
Newsgroups: sybase.public.powerbuilder.objects
Subject: Re: How to assign to a variable as reference or make an alias of a control
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4ae02906.3322.1681692777@sybase.com>
References: <4ae0158e$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 22 Oct 2009 02:42:30 -0700
X-Trace: forums-1-dub 1256204550 10.22.241.41 (22 Oct 2009 02:42:30 -0700)
X-Original-Trace: 22 Oct 2009 02:42:30 -0700, 10.22.241.41
Lines: 66
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9941
Article PK: 737077

Thank you very much.

> This technique can be further improved to become a general
> way of referencing all the datawindow controls within the
> form:
>
> 1) declare instance array of datawindow type:
> datawindow dws[]
>
> 2) for each of the datawindow controls within tabpages
> declare instance constant to be used as index within the
> array: constant integer CI_DW_MAIN = 1
> constant integer CI_DW_EDU = 2
> constant integer CI_DW_HIST = 3
> etc...
>
> 3) on window opening prepare the array, just like Jeremy
> wrote: dws[CI_DW_MAIN] = tab_1.page1.dw_main
> dws[CI_DW_EDU] = tab_1.page1.tab_2.page1.dw_education
> dws[CI_DW_HIST] = tab_1.page1.tab_2.page1.tab_3.page1.dw_1
> etc.
>
> 4) after that, simply use dws[<CI_dw_constant>] to
> reference the desired control
>
> And I hope that the example you wrote
> "tab_1.page1.tab_2.page1.tab_3.page1.dw_1" is not a real
> thing - I would prefer to put meaningful suffixes of the
> controls instead of the default numeric ones :-)
>
> Regards,
> Ivaylo
>
> "Jeremy Lakeman" <jeremy.lakeman@gmail.com> wrote in
> message
> news:530b500c-d10b-44de-a82c-ccbd20fdce46@b25g2000prb.goog
> legroups.com... On Oct 22, 5:32 pm, Neil wrote:
> > Hi everyone, I happen to have this structure that is
> > considerably long. example, I have a control structure
> > like this:
> >
> > tab_1.page1.tab_2.page1.tab_3.page1.dw_1
> >
> > Accessing dw_1 in code would make my code too long. I
> > would like that in code, I can maybe declare a
> > datawindow variable (ldw_ref) and assign dw_1 into that
> > variable as reference so that in code, I may just write
> > it shorter. Instead of writing, tab_1.page1... until I
> > reached dw_1. repeating that for all columns of dw_1 is
> so tedious to write. >
> > All I know is that I can pass it to a function as
> > reference. But I am not coding in a function. Is there
> > any other way to achieve the above outside a function?
> >
> > TIA
> > Neil
>
> Yep, just like that.
>
> datawindow ldw_1
> ldw_1 = tab_1.page1.tab_2.page1.tab_3.page1.dw_1
>
> ldw_1.retrieve()
> ...
>
>