quote:
Originally posted by CookieRevised
What happens if you uncomment all the commented lines and change the SendMessage text to something very short like "testx", and change the empty string from SetControlText to something else like "test3" (to see if it realy changes the control text)?:JScript code:
function OngetbackEvent_EditTextChanged(wnd,ic){
var str =""+wnd.GetControlText(ic).toLowerCase();
schermpje.SendMessage("test1");
if(str.search("_")>=0){
str = str.substring(0,str.length-1);
if(str == "close"){
wnd.Close(36259)
}else{
Debug.Trace("Handle: " + schermpje.Handle);
Debug.Trace("Allowed: " + schermpje.EditChangeAllowed);
Debug.Trace("SendMsg: " + schermpje.SendMessage("test2"));
Debug.Trace("str: "+str);
wnd.SetControlText("txtje","test3")
}
}
}
The result from the debug window:
Handle: 16975412
Allowed: true
SendMsg: true
str: test3
The text in the messenger window:
test1
test1
test1
test1
The text in the plus window:
test3
And it just got a little stranger...
I noticed this when I used the following code:
Javascript code:
function OngetbackEvent_EditTextChanged(wnd,ic){
var str =""+wnd.GetControlText(ic).toLowerCase();
schermpje.SendMessage("test1");
if(str.search("_")>=0){
str = str.substring(0,str.length-1);
if(str == "close"){
wnd.Close(36259)
}else{
Debug.Trace("Handle: " + schermpje.Handle);
Debug.Trace("Allowed: " + schermpje.EditChangeAllowed);
Debug.Trace("SendMsg: " + schermpje.SendMessage("test2"));
Debug.Trace("str: "+str);
schermpje.SendMessage("test1");
wnd.SetControlText("txtje","")
}
}
}
When I enter letters it sends test1, but as soon as I enter _ it doesn't... Debug from just entering _ :
code:
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str:
> Functieaanroep: "OngetbackEvent_EditTextChanged"
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str:
> Functieaanroep: "OngetbackEvent_EditTextChanged"
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str:
> Functieaanroep: "OngetbackEvent_EditTextChanged"
I now have the feeling something goes wrong because the SetControlText calls the function again... But I don't understand why that would be a problem...
edit:
ok I tried something different... and it didn't explain anything... but did raise more questions...
Javascript code:
function OngetbackEvent_EditTextChanged(wnd,ic){
var str =""+wnd.GetControlText(ic).toLowerCase();
schermpje.SendMessage("test1");
if(str.search("_")>=0){
str = str.substring(0,str.length-1);
if(str == "close"){
wnd.Close(36259)
}else{
Debug.Trace("Handle: " + schermpje.Handle);
Debug.Trace("Allowed: " + schermpje.EditChangeAllowed);
Debug.Trace("SendMsg: " + schermpje.SendMessage("test2"));
Debug.Trace("str: "+str);
schermpje.SendMessage(""+str);
//wnd.SetControlText("txtje","")
}
}
}
inserted text in the getback edit field: a__d_a
result in chatwindow:
test1
test1
test1
test2
a__
result in debugwindow:
code:
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a_
> Functieaanroep: "OngetbackEvent_EditTextChanged"
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
Handle: 19728798
Allowed: true
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
SendMsg: true
str: a__
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a__d
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a__d_
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a__d_a