cancel
Showing results for 
Search instead for 
Did you mean: 

TimeDelayed in Selecting CheckBox

Former Member
0 Kudos

Hi To All

I am Having 5 CheckBoxes in my screen..In that last checkbox is SelectAll Checkbox..If i select that check box, all the other 4 checkboxes should be checked..Its working fine..But, when i click the SelectAll checkbox after 4 to 5 Seconds only all the other checkboxes are selected..I had given form freeze...Wats the problem...Here is my source code..


 Try
 Conv_Form.Freeze(True)
 Select Case pVal.EventType
 Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
 If pVal.ItemUID = "chkSelectAll" And pVal.BeforeAction = False Then
     If ChkSelectAll.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"
      End If
  End If
 End Select
 Conv_Form.Freeze(False)
 Catch ex As Exception
 Conv_Form.Freeze(False)
 End Try

End Sub

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Sridhar,

I think, that after Chk1.Checked = "True" is called other event for checking checkbox and this is doing something. Try to do it as

1. declare global variable calculate as boolean and set there default value True

dim calculate as boolean
calculate = True

2. change the code as

Try
 Conv_Form.Freeze(True)
 Select Case pVal.EventType
 Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
 If pVal.ItemUID = "chkSelectAll" And pVal.BeforeAction = False Then
     calculate = False
     If ChkSelectAll.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"
      End If
  End If
 End Select
 caclulate = True
 Conv_Form.Freeze(False)
 Catch ex As Exception
 Conv_Form.Freeze(False)
 End Try

3. in itemevent add condition, that everyting in itemevent will be executed only when calculate = True

if caclulate = True then
.. your itemevent

end if

In the past I fought with simillar problem and with variable for testing in itemevent it was solved. Its just idea and maybe it will not works for you, but you may try it.

Former Member
0 Kudos

Hi Petr,

I am not able to understand ur last part..i had already given that source in item event...you had specified that


If calculate = true then
...Your itemevent
end if

What is this meant by.....?

Former Member
0 Kudos

Here is my source....Whether this is correct...?

My declaration


Dim calculate As Boolean = True

This is my Item Event..

 
Sub ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean)
     Try
            If calculate = True Then
                Conv_Form.Freeze(True)
                Select Case pVal.EventType
                    Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
                        If pVal.ItemUID = "chkSelectAll" And pVal.BeforeAction = False Then
                            calculate = False
                            If ChkSelect.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"
                            End If
                      End If
                 End Select
                calculate = True
                Conv_Form.Freeze(False)
            End If
        Catch ex As Exception
            Conv_Form.Freeze(False)
        End Try
    End Sub

Former Member
0 Kudos

it seems to be ok, the only thing I cannot see from your itemevent is how is Chk1 ... 4 and ChkSelect instantiated - its global variable for this?

Former Member
0 Kudos

Hi Petr, i had given like this....


Sub ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean)
        Dim ChkSelectAll As SAPbouiCOM.CheckBox = Conv_Form.Items.Item("chkSelectAll").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
        Try
            Conv_Form.Freeze(True)
            Select Case pVal.EventType
                Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
                    If pVal.ItemUID = "chkSelectAll" And pVal.BeforeAction = False And calculate = True Then
                        If ChkSelect.Checked = True Then
                            calculate = False
                            Chk1.Checked = True
                            Chk2.Checked = True
                            Chk3.Checked = True
.....
...
.
..
..

Former Member
0 Kudos

ok, and how do you have instantiated Conv_Form? I think that it must works.

Former Member
0 Kudos

Imports System.Reflection
Public Class ProductionClass
    Dim Conv_Form As SAPbouiCOM.Form
    Dim db As SAPbouiCOM.DBDataSource
    Dim calculate As Boolean = True
....
....
....
....
Former Member
0 Kudos

for me is there missing something like

conv_form = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)

because you have the conv_form declared globaly, so I dont know, how you are doing it, when the user has opened more forms at a time.

Edited by: Petr Verner on Sep 24, 2008 7:02 AM

Former Member
0 Kudos

For me only one form will be opened at a time....

Answers (0)