cancel
Showing results for 
Search instead for 
Did you mean: 

CheckBox Selection

Former Member
0 Kudos

I am having 5 check boxes in my screen..In that last checkbox is SELECT ALL.... If i had selected that checkbox all the other 4 checkboxes shd be selected. if i unchecked that checkbox all the others shd be unchecked...for this i had wrote the source in item event....Here is my source..


 Select Case pVal.EventType
Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
Dim ChkALL As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chkALL").Specific
Dim Chk1 As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chk1").Specific
Dim Chk2 As SAPbouiCOM.CheckBox = 
Conv_Form.Items.Item("chk2").Specific
Dim Chk3 As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chk3").Specific
Dim Chk4 As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chk4").Specific
    If ChkALL.Checked = "True" Then
       Chk1.Checked = "True"
       Chk2.Checked = "True"
       Chk3.Checked = "True"
       Chk4.Checked = "True"
     Else
        Chk1.Checked = "False"
        Chk2.Checked = "False"
        Chk3.Checked = "False"
        Chk4.Checked = "False"
        ChkALL.Checked = "False"
     End If
End Select

What i want is whenever i select the SelectAll checkbox all the other checkboxes should be selected atonce..but in my case, the checkboxes are checked one by one.....

Wats the solution for this.....

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

For that u can use Form Freez and Unfreez. That will help u solve it..

Dim ChkALL As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chkALL").Specific
                Dim Chk1 As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chk1").Specific
                Dim Chk2 As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chk2").Specific
                Dim Chk3 As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chk3").Specific
                Dim Chk4 As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chk4").Specific
                oForm.Freez() = True 'use ur form object.
                If ChkALL.Checked = "True" Then
                    Chk1.Checked = "True"
                    Chk2.Checked = "True"
                    Chk3.Checked = "True"
                    Chk4.Checked = "True"
                Else
                    Chk1.Checked = "False"
                    Chk2.Checked = "False"
                    Chk3.Checked = "False"
                    Chk4.Checked = "False"
                    ChkALL.Checked = "False"
                End If
                oForm.Freez() = False 'use ur form object.

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

Thanks for ur quick response......i had given form.freeze..But after 5 to 6 Seconds only all the other checkboxes are checked...Wat to do for this.....

Former Member
0 Kudos

Hi,

I would work with the Check boxes via DataSources (it' always a good idea to bind everything on a form with DataSources - if ther's no DBDataSource or DataTable then using a UserDataSource)

In your case with UserDataSources I would try:


            ' Global Vars of your form:
            Private Shared oForm As SAPbouiCOM.Form ' Set to your form on initializing the form
            Private Shared oUds As SAPbouiCOM.UserDataSources ' Set to the forms UserDataSources on initializing the form


            ' Init. and Databinding the Checkboxes: 
            oChk = oForm.Items.Item("ChkALL").Specific
            oChk.ValOff = "N"
            oChk.ValOn = "Y"

            oChk = oForm.Items.Item("Chk1").Specific
            oChk.ValOff = "N"
            oChk.ValOn = "Y"
            '       :     
            '       :
            ' ...same with chk2-chk4


            oUds.Add("UDS_ChkAll", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)
            oForm.Items.Item("ChkALL").Specific.databind.setbound(True, "", "UDS_ChkAll")
            '       :     
            '       :
            ' ...same with chk1-chk4

And in your function or event-handler (for item ChkAll with ItemPressed and NOT BeforeAction):


    If oUds.Item("UDS_ChkALL").ValueEx = "Y" Then
       oUds.Item("UDS_Chk1").ValueEx = "Y"
       oUds.Item("UDS_Chk2").ValueEx = "Y"
       oUds.Item("UDS_Chk3").ValueEx = "Y"
       oUds.Item("UDS_Chk4").ValueEx = "Y"
     Else
       oUds.Item("UDS_Chk1").ValueEx = "N"
       oUds.Item("UDS_Chk2").ValueEx = "N"
       oUds.Item("UDS_Chk3").ValueEx = "N"
       oUds.Item("UDS_Chk4").ValueEx = "N"
       ' This should not be needed: oUds.Item("UDS_ChkALL").ValueEx = "N"
     End If

Attention: this is written from my head an not tested yet. There may be some little mistakes but in principle it should be ok.

Edited by: Roland Toschek on Sep 19, 2008 3:10 PM

Edited by: Roland Toschek on Sep 19, 2008 3:14 PM

Former Member
0 Kudos

Thanks a lot....

Answers (0)