cancel
Showing results for 
Search instead for 
Did you mean: 

4 Radio Button

Former Member
0 Kudos

Hi,

My 4 radio button doesn't work.

The light inside the radio button do not light up when I click on the radio button.…The code behind work fine but not the group with option.

Do you have any code sample?

Thank you very much for your support!

Rune

Accepted Solutions (0)

Answers (1)

Answers (1)

Nussi
Active Contributor
0 Kudos

Hi Brune,

you should create one datasource and bind it to both items

heres a vb6 sample - use this when loading the form


            frm.DataSources.UserDataSources.Add "optDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1
            frm.Items.item("optNeu").Specific.DataBind.SetBound True, "", "optDS"
            frm.Items.item("optNeu").Enabled = True

            frm.Items.item("optLaden").Specific.DataBind.SetBound True, "", "optDS"
            frm.Items.item("optLaden").Enabled = True
            
            frm.Items.item("optLaden").Specific.GroupWith ("optNeu")
            frm.DataSources.UserDataSources("optDS").Value = 1

if you need something ask me

regards

David

Former Member
0 Kudos

Hi David,

I tried to solve the issue by looking at your VB code, but it is not the same as my C# code:

This code do not work, why?

// Per Day

oItem = oFormP1.Items.Add("optDay4P1", SAPbouiCOM.BoFormItemTypes.it_OPTION_BUTTON);

oItem.Left = 750;

oItem.Top = 160;

oItem.FromPane = 4;

oItem.ToPane = 4;

oOptionBtn = ( ( SAPbouiCOM.OptionBtn ) ( oItem.Specific ) );

oOptionBtn.Caption = "Per Day";

oOptionBtn.ValOn = "DayP1";

oOptionBtn.DataBind.SetBound(true, "", "BtnDS4AP1");

// Per Week

oItem = oFormP1.Items.Add("optWeek4P1", SAPbouiCOM.BoFormItemTypes.it_OPTION_BUTTON);

oItem.Left = 750;

oItem.Top = 180;

oItem.FromPane = 4;

oItem.ToPane = 4;

oOptionBtn = ( ( SAPbouiCOM.OptionBtn ) ( oItem.Specific ) );

oOptionBtn.Caption = "Per Week";

oOptionBtn.ValOn = "WeekP1";

oOptionBtn.GroupWith("optDay4P1");

oOptionBtn.DataBind.SetBound(true, "", "BtnDS4AP1");

// Per Month

oItem = oFormP1.Items.Add("optMont4P1", SAPbouiCOM.BoFormItemTypes.it_OPTION_BUTTON);

oItem.Left = 750;

oItem.Top = 200;

oItem.FromPane = 4;

oItem.ToPane = 4;

oOptionBtn = ( ( SAPbouiCOM.OptionBtn ) ( oItem.Specific ) );

oOptionBtn.Caption = "Per Month";

oOptionBtn.ValOn = "MonthP1";

oOptionBtn.GroupWith("optWeek4P1");

oOptionBtn.DataBind.SetBound(true, "", "BtnDS4AP1");

// All

oItem = oFormP1.Items.Add("optAll4P1", SAPbouiCOM.BoFormItemTypes.it_OPTION_BUTTON);

oItem.Left = 750; //850

oItem.Top = 220;

oItem.FromPane = 4;

oItem.ToPane = 4;

oOptionBtn = ( ( SAPbouiCOM.OptionBtn ) ( oItem.Specific ) );

oOptionBtn.Caption = "All";

oOptionBtn.ValOn = "AllP1";

oOptionBtn.GroupWith("optMont4P1");

oOptionBtn.DataBind.SetBound(true, "", "BtnDS4AP1");

Former Member
0 Kudos

Hey Rune,

Please - do yourself a favor and stop adding item using code - it's slow, cumbersome and very exhausting, specially in the long run.

I use XML all the time - event to add a few labels/buttons in a system form.

here's an example for working grouped radio buttons (in the correct forms/add action/form XML hirarcy):


<action type="add">
<item uid="48" type="122" left="132" tab_order="0" width="160" top="91" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="1" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute/>
<specific caption="Radio 1" AffectsFormMode="1" val_on="Y" val_off="N">
<databind databound="1" table="" alias="Radio"/>
</specific>
</item>
<item uid="49" type="122" left="132" tab_order="0" width="160" top="106" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="1" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute/>
<specific caption="Radio 2" AffectsFormMode="1" val_on="Y" val_off="N">
<databind databound="1" table="" alias="Radio"/>
</specific>
</item>
</action>
<action type="group">
<item uid="48"/>
<item uid="49"/>
</action>

Edited by: Avi Bandel on Mar 27, 2008 9:48 PM

Nussi
Active Contributor
0 Kudos

Hi Rune,

try to first use setbound and than groupwith.

and also be sure that the datasource "BtnDS4AP1" is short_text, 1

and try it than without the valon - maybe it has something to do with it

regards

David

Former Member
0 Kudos

...I give up...

...Next project I will use Screen Painter and modify in the XML file...

...Thank you very much for your feedback!

Thank you,

Rune