Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Enable/disable radionbuttons in datawindow

574 views
Skip to first unread message

Ian Brouwer

unread,
Sep 21, 2004, 4:43:17 AM9/21/04
to
Hi All,

I have a datawindow with a column being displayed as a number of
readiobuttons (the column edit style type = RadioButtons).
Under certain circumstances, I need to disable some radiobuttons so they
appear 'ghosted' and the user cannot select it.
Could someone tell me if this is possible and if so, please provide the
syntax.

Thanks in advance.


Bruce Armstrong [TeamSybase]

unread,
Sep 21, 2004, 8:53:57 AM9/21/04
to
It's not directly supported yet. All I can suggest is creating a
bitmap that looks like the command button except grayed out and making
it visible over the command button.

On 21 Sep 2004 01:43:17 -0700, "Ian Brouwer" <i_bNOro...@tsd.nl>
wrote:

Bruce Armstrong [TeamSybase]
http://www.teamsybase.com

TeamSybase blogs:
http://www.teamsybase.net/blogs

Two 3rd party books on developing with PowerBuilder
http://www.pb9books.com?source=newsgroups

Need code sample? Check out CodeXchange:
http://www.codexchange.sybase.com

Preach the gospel at all times. If necessary, use words. - Francis of Assisi
http://www.needhim.org

---------------------------------------------------------------------
DISCLAIMER:

This newsgroup message is only intended for the recipient. Given that it
is a posting to a public newsgroup, that means if you can read this
message then you are the recipient. This message may contain information
that is confidential and protected from disclosure. And then again,
it may not.

Given that TeamSybase members are not employees of Sybase, the contents
of this message do not necessarily represent the views or policies of
Sybase. Given that TeamSybase is a diverse group of users of Sybase
products, the contents of this message do not necessarily represent the
views of a significant number of the members of TeamSybase. Given that the
author has multiple personalities and hears voices in his head, the contents
of this message do not necessarily represent his own views.

Paul Horan[TeamSybase]

unread,
Sep 21, 2004, 9:38:55 AM9/21/04
to
To "disable" a radiobutton column:

string ls_modstring

ls_Modstring = + &
as_ColName + ".radiobuttons.3D=NO " + &
as_ColName + ".radiobuttons.scale=YES "

dw_1.Modify( ls_modstring )

To enable that same column, flip the NO's and YES's.

--
Paul Horan[TeamSybase]

"Ian Brouwer" <i_bNOro...@tsd.nl> wrote in message news:414feb74$1@forums-2-dub...

Chris Pollach

unread,
Sep 21, 2004, 10:10:14 AM9/21/04
to
Paul;

I basically use Paul's approach but execute this through an SQL computed
column (acting as a switch) and placing expressions on the RB's that
interrogate the CC's state and set the various properties accordingly. This
saves allot of external DW Control code like Paul has shown you. However,
either technique achieves the same end result.

Food for thought.

Regards ... Chris


"Paul Horan[TeamSybase]" <paulhATvcisolutionsDOTcom> wrote in message
news:415030bf$1@forums-2-dub...

Paul Horan[TeamSybase]

unread,
Sep 21, 2004, 11:01:38 AM9/21/04
to
"Chris Pollach" <Poll...@SCC-CSC.gc.ca> wrote in message news:41503818$1@forums-2-dub...

> Paul;
>
> I basically use Paul's approach but execute this through an SQL computed
> column (acting as a switch) and placing expressions on the RB's that
> interrogate the CC's state and set the various properties accordingly. This
> saves allot of external DW Control code like Paul has shown you. However,
> either technique achieves the same end result.
>
> Food for thought.
>
> Regards ... Chris
>
>


We created a function in the ancestor datawindow - uo_EnableCol( string as_colName, boolean ab_Enable)

The code I showed is in the function, and it handles all the other edit styles as well. So our application code only
has to call:
dw_1.uo_EnableCol( 'myColumn', TRUE ) - to enable, and vice versa to disable.

That saves having to code extra controls into the datawindow itself. More food for thought... ;)

--
Paul Horan[TeamSybase]


Ian Brouwer

unread,
Sep 22, 2004, 3:00:24 AM9/22/04
to
Paul,

Thanks for the tip, except the example disabled the 'column' instead of one
of the radio buttons for 1 of the values for that column.

Example:
The column name is 'Status' which can contain the values 0, 1 or 2.
So in normal circumstances 3 radio buttons for this column will be enabled
and displayed.
In certain circumstances I want all radio buttons to be visible, but only
enable the radio buttons for the values 1 and 2, and disable the radio
button for the value 0.

Can anyone help we this one ?

Ian
"Paul Horan[TeamSybase]" <paulhATvcisolutionsDOTcom> schreef in bericht
news:415030bf$1@forums-2-dub...

Paul Horan[TeamSybase]

unread,
Sep 22, 2004, 6:40:04 AM9/22/04
to
"Ian Brouwer" <i_bNOro...@tsd.nl> wrote in message news:41512308@forums-1-dub...

> Paul,
>
> Thanks for the tip, except the example disabled the 'column' instead of one
> of the radio buttons for 1 of the values for that column.
>
> Example:
> The column name is 'Status' which can contain the values 0, 1 or 2.
> So in normal circumstances 3 radio buttons for this column will be enabled
> and displayed.
> In certain circumstances I want all radio buttons to be visible, but only
> enable the radio buttons for the values 1 and 2, and disable the radio
> button for the value 0.
>
> Can anyone help we this one ?
>
> Ian


I would add two computed columns to the select statement:
...
0 as three_choice,
0 as two_choice,
FROM
...

Set each of these up as radio buttons - the first with all three choices, and the second with only two (I don't think
there's a way to display the third as disabled). Don't even put the original column on the dw surface. Then toggle the
visible attribute for these two to display the one you want and hide the other. Use the ItemChanged event to do
SetItem( row, "original_rb_column", data ) when either of the two "fake" columns are changed.

--
Paul Horan[TeamSybase]


Chris Pollach

unread,
Sep 22, 2004, 7:59:07 AM9/22/04
to

Another good implementation for sure!

"Paul Horan[TeamSybase]" <paulhATvcisolutionsDOTcom> wrote in message

news:41504423@forums-2-dub...

Chris Pollach

unread,
Sep 22, 2004, 8:00:09 AM9/22/04
to
Sure would be nice to address this in PB 11 a little more elegantly!


"Paul Horan[TeamSybase]" <paulhATvcisolutionsDOTcom> wrote in message

news:41515684@forums-1-dub...

philipsalgannik

unread,
Sep 22, 2004, 11:43:21 AM9/22/04
to

> Thanks for the tip, except the example disabled the
> 'column' instead of one of the radio buttons for 1 of the
> values for that column.
>
> Example:
> The column name is 'Status' which can contain the values 0
> , 1 or 2. So in normal circumstances 3 radio buttons for
> this column will be enabled and displayed.
> In certain circumstances I want all radio buttons to be
> visible, but only enable the radio buttons for the values
> 1 and 2, and disable the radio button for the value 0.

Radio button edit style for the column is a poor choice - it
is just a code table presented in a funky way/ The code
table is common for the column in ALL the rows.
Use a dddw edit style either with:
1) Easier - visual indicator that n of the choices are not
suitable combined with scripting in the itemchanged that
disallows their choice
2) Harder - creative conditional filtering of the dddw

0 new messages