cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get Checkbox to check

Former Member
0 Kudos

Hi I am having trying to get my checkbox to check...

I can get a reference to the checkbox object, change the display text etc with the object, but when I set the checked state to true it always remains unchecked???

Below is my code:

public override void CatchItemEvent(string FormUid, ref SAPbouiCOM.ItemEvent ItmEvent, out bool BubbleEvent)

{

BubbleEvent = true;

if(FormUid == "frmBulkPriceUpdate" && !ItmEvent.BeforeAction && ItmEvent.EventType == BoEventTypes.et_CLICK)

{

SAPbouiCOM.CheckBox cbQuotes = (SAPbouiCOM.CheckBox)_SboForm.Items.Item("cbQuotes").Specific;

SAPbouiCOM.CheckBox cbOrders = (SAPbouiCOM.CheckBox)_SboForm.Items.Item("cbOrders").Specific;

SAPbouiCOM.EditText txtDate = (SAPbouiCOM.EditText)_SboForm.Items.Item("txtDate").Specific;

switch(ItmEvent.ItemUID)

{

case "cbOrders" :

cbOrders.Checked = true;

SboApplication.SetStatusBarMessage(cbOrders.Checked.ToString(), BoMessageTime.bmtShort, false);

break;

case "cbQuotes" :

cbQuotes.Checked = true;

break;

case "butLaunch" :

int confirm = _SboApplication.MessageBox(

"Are you sure you want to run the Automatic Update?",

0,

"OK",

"Cancel",

"");

if(confirm == 1)

UpdatePrices(true, true, txtDate.String);

break;

}

}

}

Accepted Solutions (0)

Answers (2)

Answers (2)

AlexGrebennikov
Active Contributor
0 Kudos

Daniel, have you bounded your CheckBox to DataSource?

If so, could you please show these code-lines

Former Member
0 Kudos

Hi Alexy, no I haven't bound it to a datasource, I just want to check / uncheck to determine if the user wants to perform an action - it is not related to any stored data...

former_member185703
Active Contributor
0 Kudos

Hi Daniel,

"datasource" does not mean DBdatasource...

A CheckBox must always be bound to a datasource (User... or DB...).

Regards,

Frank

Former Member
0 Kudos

Thanks for the help! Had never done this before, Below is the code that did the trick.

SboForm.DataSources.UserDataSources.Add("cbOrdersDs", BoDataType.dtSHORT_TEXT, 1);

SboForm.DataSources.UserDataSources.Add("cbQuotesDs", BoDataType.dtSHORT_TEXT, 1);

SAPbouiCOM.CheckBox cbOrders = (SAPbouiCOM.CheckBox)_SboForm.Items.Item("cbOrders").Specific;

SAPbouiCOM.CheckBox cbQuotes = (SAPbouiCOM.CheckBox)_SboForm.Items.Item("cbQuotes").Specific;

cbOrders.DataBind.SetBound(true, "", "cbOrdersDs");

cbOrders.ValOn = "Y";

cbOrders.ValOff = "N";

cbOrders.Checked = true;

cbQuotes.DataBind.SetBound(true, "", "cbQuotesDs");

cbQuotes.ValOn = "Y";

cbQuotes.ValOff = "N";

cbQuotes.Checked = true;

Former Member
0 Kudos

what I found was if I created a Check Box with code, it behaves well (without me having to manually set the Checked value)

if I create the chekc box with the aid of Screen Painer then the box does not behave well.. checks but does not uncheck etc...

hope this helps here.

AdKerremans
Active Contributor
0 Kudos

Hi Daniel,

I also had problems with checkbox and radiobuttons.

I use the click event, with doubleclick and now it works perfectly (why the regualr click doesn't work I don't know)

Regards,

Ad