I have a problem guys and hopefully you can help me.
I write a series of code in the EditChanged Event of my datawindow user object to validate if the character entered is a valid numeric figure. It works fine that the field only accept numeric figures.
--Here is my code in the EditChanged Event
--Start
//Start of variable declarations
Long ll_ctr
Long ll_len
Long ll_pos
Long ll_index
String ls_column
String ls_type
String ls_value
String ls_newvalue
String ls_char
String ls_style
//End of variable declarations
ls_column = this.GetColumnName()
ls_type = this.Describe(ls_column + '.coltype')
If left(ls_type,4) = 'deci' Then
ls_style = this.Describe(ls_column + '.Edit.Style')
If ls_style <> 'dddw' Then
ls_value = String(data)
ll_pos = this.Position()
ll_len = len(ls_value)
If ll_len = 0 Then Return
this.SetItem(row, ls_column, f_removechar(Trim(ls_value)))
this.SetColumn(ls_column)
ls_newvalue = String(this.GetItemDecimal(row, ls_column))
ls_char = Mid(data, ll_pos - 1, 1)
ll_index = Pos(ls_newvalue, '.', 1)
If ll_len > len(ls_newvalue) and ls_char <> "." and ll_pos - 1 <= ll_index Then
this.SelectText(ll_pos - 1, 0)
ElseIf ls_char = "." Then
this.SelectText(ll_pos, 0)
ElseIf ll_len > len(ls_newvalue) and ll_pos > ll_index and IsNumber(ls_char) = False Then
this.SelectText(ll_pos - 1, 0)
Else
this.SelectText(ll_pos, 0)
End If
End If
End If
--End of EditChanged Event code
The function f_removechar is function that will return the valid numeric figures.
What my problem with this code in the EditChanged Event is that after I leave the column it doesn't pass in the ItemChanged Event of the datawindow. I really need to pass in the ItemChanged Event because there are still series of code to be executed but unfortunately they were not entertained.
Kindly help me to figure out this problem.
Thanks for the help.
I write a series of code in the EditChanged Event of my datawindow user object to validate if the character entered is a valid numeric figure. It works fine that the field only accept numeric figures.
--Here is my code in the EditChanged Event
--Start
//Start of variable declarations
Long ll_ctr
Long ll_len
Long ll_pos
Long ll_index
String ls_column
String ls_type
String ls_value
String ls_newvalue
String ls_char
String ls_style
//End of variable declarations
ls_column = this.GetColumnName()
ls_type = this.Describe(ls_column + '.coltype')
If left(ls_type,4) = 'deci' Then
ls_style = this.Describe(ls_column + '.Edit.Style')
If ls_style <> 'dddw' Then
ls_value = String(data)
ll_pos = this.Position()
ll_len = len(ls_value)
If ll_len = 0 Then Return
this.SetItem(row, ls_column, f_removechar(Trim(ls_value)))
this.SetColumn(ls_column)
ls_newvalue = String(this.GetItemDecimal(row, ls_column))
ls_char = Mid(data, ll_pos - 1, 1)
ll_index = Pos(ls_newvalue, '.', 1)
If ll_len > len(ls_newvalue) and ls_char <> "." and ll_pos - 1 <= ll_index Then
this.SelectText(ll_pos - 1, 0)
ElseIf ls_char = "." Then
this.SelectText(ll_pos, 0)
ElseIf ll_len > len(ls_newvalue) and ll_pos > ll_index and IsNumber(ls_char) = False Then
this.SelectText(ll_pos - 1, 0)
Else
this.SelectText(ll_pos, 0)
End If
End If
End If
--End of EditChanged Event code
The function f_removechar is function that will return the valid numeric figures.
What my problem with this code in the EditChanged Event is that after I leave the column it doesn't pass in the ItemChanged Event of the datawindow. I really need to pass in the ItemChanged Event because there are still series of code to be executed but unfortunately they were not entertained.
Kindly help me to figure out this problem.
Thanks for the help.