How to get a row number in DDDW

Hi, All,
     When a DDDW on a column opens for the user to pick an item, and
when the user clicks on a row or scrolls up/down in the DDDW, is there
any way to get the row number of the DDDW? I have tried this in PB 5,
and it did not seem to work. Any ideas about PB 6.5 or PB 7.0? Thanks in
advance.

0
Ben
8/24/1999 10:18:02 PM
sybase.powerbuilder.general 62418 articles. 18 followers. Follow

5 Replies
881 Views

Similar Articles

[PageSpeed] 48

Ben

You can't directly get the row that the user clicked on. You can write code
in the ItemChanged event of the parent DW where you get the data value on
the parent column, get a handle to the child DW, then perform a Find ( ) on
the child DW looking the the data value in the relevant column. This will
tell you which row had the selected value.

HTH

Sanjiv Das [TeamSybase]


Ben Gong <dazhig@yahoo.com> wrote in message
news:37C31A1A.DEAEF47@yahoo.com...
> Hi, All,
>      When a DDDW on a column opens for the user to pick an item, and
> when the user clicks on a row or scrolls up/down in the DDDW, is there
> any way to get the row number of the DDDW? I have tried this in PB 5,
> and it did not seem to work. Any ideas about PB 6.5 or PB 7.0? Thanks in
> advance.
>


0
Sanjiv
8/25/1999 3:58:02 AM
Sanjiv & Ben, 

Use the GETROW() function on the Datawindowchild to get the row selected by the
user in a DDDW.  Following is the sample code:

/**********************************************************************/
datawindowchild ldwc_customer
long ll_rtncode, ll_row, ll_custid
String ls_customer

// Get the DDDW attached to the 'cust_id' column.
ll_rtncode = dw_order.GetChild('cust_id', ldwc_customer)

IF ll_rtncode = -1 THEN MessageBox("Error", "Not a DataWindowChild")

// Get the row selected by the user
ll_row = ldwc_customer.getrow()

// For DEBUG purpose.
// Get the ID & Company Name from the Datawindowchild
ll_custid   = ldwc_customer.GetItemNumber(ll_row, 'id')
ls_customer = ldwc_customer.GetItemString(ll_row, 'company_name')

MessageBox ( 'Select ID and Customer', 'ID   : ' + &
                                       string(ll_custid) + '~n~r' + &
                                       'Name : ' + ls_customer)
/****************************************************************************/

I am not sure whether there are any events that gets executed when the user is
scrolling in a DDDW. 

Sambu Subramanyam
Saudi Aramco
Dhahran, Saudi Arabia.

On Tue, 24 Aug 1999 20:58:02 -0700,
 in powersoft.public.powerbuilder.general
Sanjiv Das [TeamSybase] <No-Spam-SDas@CompuServe.Com> wrote: 
>Ben
>
>You can't directly get the row that the user clicked on. You can write code
>in the ItemChanged event of the parent DW where you get the data value on
>the parent column, get a handle to the child DW, then perform a Find ( ) on
>the child DW looking the the data value in the relevant column. This will
>tell you which row had the selected value.
>
>HTH
>
>Sanjiv Das [TeamSybase]
>
>
>Ben Gong <dazhig@yahoo.com> wrote in message
>news:37C31A1A.DEAEF47@yahoo.com...
>> Hi, All,
>>      When a DDDW on a column opens for the user to pick an item, and
>> when the user clicks on a row or scrolls up/down in the DDDW, is there
>> any way to get the row number of the DDDW? I have tried this in PB 5,
>> and it did not seem to work. Any ideas about PB 6.5 or PB 7.0? Thanks in
>> advance.
>>
>
>
0
Sambu
8/25/1999 6:55:22 AM
Thanks for both. The problem with this technique is the ItemChanged event only
fires once and this will only gets the first row fo the DDDW the user selects. If
the user scrolls up and down in the DDDW, and the item remains the same, the
ItemChanged event does not fire. Here is what I have to do:
       The State criminal statute codes have chapters, sections, subdivisions and
sequences. A chapter always has more than one section, which almost always has more
than one subdivision, whih may have more than one sequence. Now all of these are
separate columns. The user wants to just select the chapter columns and wants me to
auto set all of the rest plus the charge description. This can be done when the
chapter is first selected, which is also the first record of that chapter. When the
user scrolls up and down the DDDW, the chapter value remains the same, so the
ItemChanged event does not fire again. Here is what the DDDW looks like:
     Chapter    Section           Subd           Sequence          Charge Desc
        609         001                2bd                1
Murder1
       609          001                2bd                2
Murder2
       609          001                2bd                3
Attempted Murder
       Etc, etc
Thanks.

Sambu Subramanyam wrote:

> Sanjiv & Ben,
>
> Use the GETROW() function on the Datawindowchild to get the row selected by the
> user in a DDDW.  Following is the sample code:
>
> /**********************************************************************/
> datawindowchild ldwc_customer
> long ll_rtncode, ll_row, ll_custid
> String ls_customer
>
> // Get the DDDW attached to the 'cust_id' column.
> ll_rtncode = dw_order.GetChild('cust_id', ldwc_customer)
>
> IF ll_rtncode = -1 THEN MessageBox("Error", "Not a DataWindowChild")
>
> // Get the row selected by the user
> ll_row = ldwc_customer.getrow()
>
> // For DEBUG purpose.
> // Get the ID & Company Name from the Datawindowchild
> ll_custid   = ldwc_customer.GetItemNumber(ll_row, 'id')
> ls_customer = ldwc_customer.GetItemString(ll_row, 'company_name')
>
> MessageBox ( 'Select ID and Customer', 'ID   : ' + &
>                                        string(ll_custid) + '~n~r' + &
>                                        'Name : ' + ls_customer)
> /****************************************************************************/
>
> I am not sure whether there are any events that gets executed when the user is
> scrolling in a DDDW.
>
> Sambu Subramanyam
> Saudi Aramco
> Dhahran, Saudi Arabia.
>
> On Tue, 24 Aug 1999 20:58:02 -0700,
>  in powersoft.public.powerbuilder.general
> Sanjiv Das [TeamSybase] <No-Spam-SDas@CompuServe.Com> wrote:
> >Ben
> >
> >You can't directly get the row that the user clicked on. You can write code
> >in the ItemChanged event of the parent DW where you get the data value on
> >the parent column, get a handle to the child DW, then perform a Find ( ) on
> >the child DW looking the the data value in the relevant column. This will
> >tell you which row had the selected value.
> >
> >HTH
> >
> >Sanjiv Das [TeamSybase]
> >
> >
> >Ben Gong <dazhig@yahoo.com> wrote in message
> >news:37C31A1A.DEAEF47@yahoo.com...
> >> Hi, All,
> >>      When a DDDW on a column opens for the user to pick an item, and
> >> when the user clicks on a row or scrolls up/down in the DDDW, is there
> >> any way to get the row number of the DDDW? I have tried this in PB 5,
> >> and it did not seem to work. Any ideas about PB 6.5 or PB 7.0? Thanks in
> >> advance.
> >>
> >
> >

0
Ben
8/25/1999 2:33:04 PM
Create a computed column in the dddw defined as
chapter+"~t"+string(sequence)
and use this for the display column.  This should mean that ItemChanged
fires for all rows.

HTH

Simon

Ben Gong wrote in message <37C3FE9F.123211A@yahoo.com>...
>Thanks for both. The problem with this technique is the ItemChanged event
only
>fires once and this will only gets the first row fo the DDDW the user
selects. If
>the user scrolls up and down in the DDDW, and the item remains the same,
the
>ItemChanged event does not fire. Here is what I have to do:
>       The State criminal statute codes have chapters, sections,
subdivisions and
>sequences. A chapter always has more than one section, which almost always
has more
>than one subdivision, whih may have more than one sequence. Now all of
these are
>separate columns. The user wants to just select the chapter columns and
wants me to
>auto set all of the rest plus the charge description. This can be done when
the
>chapter is first selected, which is also the first record of that chapter.
When the
>user scrolls up and down the DDDW, the chapter value remains the same, so
the
>ItemChanged event does not fire again. Here is what the DDDW looks like:
>     Chapter    Section           Subd           Sequence          Charge
Desc
>        609         001                2bd                1
>Murder1
>       609          001                2bd                2
>Murder2
>       609          001                2bd                3
>Attempted Murder
>       Etc, etc
>Thanks.
>
>Sambu Subramanyam wrote:
>
>> Sanjiv & Ben,
>>
>> Use the GETROW() function on the Datawindowchild to get the row selected
by the
>> user in a DDDW.  Following is the sample code:
>>
>> /**********************************************************************/
>> datawindowchild ldwc_customer
>> long ll_rtncode, ll_row, ll_custid
>> String ls_customer
>>
>> // Get the DDDW attached to the 'cust_id' column.
>> ll_rtncode = dw_order.GetChild('cust_id', ldwc_customer)
>>
>> IF ll_rtncode = -1 THEN MessageBox("Error", "Not a DataWindowChild")
>>
>> // Get the row selected by the user
>> ll_row = ldwc_customer.getrow()
>>
>> // For DEBUG purpose.
>> // Get the ID & Company Name from the Datawindowchild
>> ll_custid   = ldwc_customer.GetItemNumber(ll_row, 'id')
>> ls_customer = ldwc_customer.GetItemString(ll_row, 'company_name')
>>
>> MessageBox ( 'Select ID and Customer', 'ID   : ' + &
>>                                        string(ll_custid) + '~n~r' + &
>>                                        'Name : ' + ls_customer)
>>
/***************************************************************************
*/
>>
>> I am not sure whether there are any events that gets executed when the
user is
>> scrolling in a DDDW.
>>
>> Sambu Subramanyam
>> Saudi Aramco
>> Dhahran, Saudi Arabia.
>>
>> On Tue, 24 Aug 1999 20:58:02 -0700,
>>  in powersoft.public.powerbuilder.general
>> Sanjiv Das [TeamSybase] <No-Spam-SDas@CompuServe.Com> wrote:
>> >Ben
>> >
>> >You can't directly get the row that the user clicked on. You can write
code
>> >in the ItemChanged event of the parent DW where you get the data value
on
>> >the parent column, get a handle to the child DW, then perform a Find ( )
on
>> >the child DW looking the the data value in the relevant column. This
will
>> >tell you which row had the selected value.
>> >
>> >HTH
>> >
>> >Sanjiv Das [TeamSybase]
>> >
>> >
>> >Ben Gong <dazhig@yahoo.com> wrote in message
>> >news:37C31A1A.DEAEF47@yahoo.com...
>> >> Hi, All,
>> >>      When a DDDW on a column opens for the user to pick an item, and
>> >> when the user clicks on a row or scrolls up/down in the DDDW, is there
>> >> any way to get the row number of the DDDW? I have tried this in PB 5,
>> >> and it did not seem to work. Any ideas about PB 6.5 or PB 7.0? Thanks
in
>> >> advance.
>> >>
>> >
>> >
>


0
Simon
8/25/1999 3:19:10 PM
Thanks. Philip also suggested this way, and tried just now. It works but this is
much slower than a table column, especially when I backspaced to delete the
entry. So I would like to create such a field by itself and let the users select
from this column. Thanks again.

Simon Caldwell wrote:

> Create a computed column in the dddw defined as
> chapter+"~t"+string(sequence)
> and use this for the display column.  This should mean that ItemChanged
> fires for all rows.
>
> HTH
>
> Simon
>
> Ben Gong wrote in message <37C3FE9F.123211A@yahoo.com>...
> >Thanks for both. The problem with this technique is the ItemChanged event
> only
> >fires once and this will only gets the first row fo the DDDW the user
> selects. If
> >the user scrolls up and down in the DDDW, and the item remains the same,
> the
> >ItemChanged event does not fire. Here is what I have to do:
> >       The State criminal statute codes have chapters, sections,
> subdivisions and
> >sequences. A chapter always has more than one section, which almost always
> has more
> >than one subdivision, whih may have more than one sequence. Now all of
> these are
> >separate columns. The user wants to just select the chapter columns and
> wants me to
> >auto set all of the rest plus the charge description. This can be done when
> the
> >chapter is first selected, which is also the first record of that chapter.
> When the
> >user scrolls up and down the DDDW, the chapter value remains the same, so
> the
> >ItemChanged event does not fire again. Here is what the DDDW looks like:
> >     Chapter    Section           Subd           Sequence          Charge
> Desc
> >        609         001                2bd                1
> >Murder1
> >       609          001                2bd                2
> >Murder2
> >       609          001                2bd                3
> >Attempted Murder
> >       Etc, etc
> >Thanks.
> >
> >Sambu Subramanyam wrote:
> >
> >> Sanjiv & Ben,
> >>
> >> Use the GETROW() function on the Datawindowchild to get the row selected
> by the
> >> user in a DDDW.  Following is the sample code:
> >>
> >> /**********************************************************************/
> >> datawindowchild ldwc_customer
> >> long ll_rtncode, ll_row, ll_custid
> >> String ls_customer
> >>
> >> // Get the DDDW attached to the 'cust_id' column.
> >> ll_rtncode = dw_order.GetChild('cust_id', ldwc_customer)
> >>
> >> IF ll_rtncode = -1 THEN MessageBox("Error", "Not a DataWindowChild")
> >>
> >> // Get the row selected by the user
> >> ll_row = ldwc_customer.getrow()
> >>
> >> // For DEBUG purpose.
> >> // Get the ID & Company Name from the Datawindowchild
> >> ll_custid   = ldwc_customer.GetItemNumber(ll_row, 'id')
> >> ls_customer = ldwc_customer.GetItemString(ll_row, 'company_name')
> >>
> >> MessageBox ( 'Select ID and Customer', 'ID   : ' + &
> >>                                        string(ll_custid) + '~n~r' + &
> >>                                        'Name : ' + ls_customer)
> >>
> /***************************************************************************
> */
> >>
> >> I am not sure whether there are any events that gets executed when the
> user is
> >> scrolling in a DDDW.
> >>
> >> Sambu Subramanyam
> >> Saudi Aramco
> >> Dhahran, Saudi Arabia.
> >>
> >> On Tue, 24 Aug 1999 20:58:02 -0700,
> >>  in powersoft.public.powerbuilder.general
> >> Sanjiv Das [TeamSybase] <No-Spam-SDas@CompuServe.Com> wrote:
> >> >Ben
> >> >
> >> >You can't directly get the row that the user clicked on. You can write
> code
> >> >in the ItemChanged event of the parent DW where you get the data value
> on
> >> >the parent column, get a handle to the child DW, then perform a Find ( )
> on
> >> >the child DW looking the the data value in the relevant column. This
> will
> >> >tell you which row had the selected value.
> >> >
> >> >HTH
> >> >
> >> >Sanjiv Das [TeamSybase]
> >> >
> >> >
> >> >Ben Gong <dazhig@yahoo.com> wrote in message
> >> >news:37C31A1A.DEAEF47@yahoo.com...
> >> >> Hi, All,
> >> >>      When a DDDW on a column opens for the user to pick an item, and
> >> >> when the user clicks on a row or scrolls up/down in the DDDW, is there
> >> >> any way to get the row number of the DDDW? I have tried this in PB 5,
> >> >> and it did not seem to work. Any ideas about PB 6.5 or PB 7.0? Thanks
> in
> >> >> advance.
> >> >>
> >> >
> >> >
> >

0
Ben
8/25/1999 5:15:52 PM
Reply: