whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
O.P. RE: Interface Writer | [beta] 1.0
The "Add Window/Control" validators work fine, but the "Change Window/Control" validators don't seem to recognise if the ID matches another window/control's ID - even though those bits use the same validation method...
js code: // works fine :)
function OnWndWriterAddWndEvent_EditTextChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtTitle") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "")
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
for (var X in WndLstId)
{
if (WndLstId.length > 0 && objWnd.GetControlText("EdtId") == WndLstId[X])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
}
}
}
}
}
// gets it wrong :(
function OnWndWriterChangeWndEvent_EditTextChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtTitle") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "")
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
for (var X in WndLstId)
{
if (WndLstId.length > 1 && objWnd.GetControlText("EdtId") == WndLstId[X])
{
if (objWnd.GetControlText("EdtId") == WndLstId[WndLstTStSel])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
}
}
}
}
// works fine :)
function OnWndWriterAddControlEvent_EditTextChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtLeft") == "" || objWnd.GetControlText("EdtDown") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "" || objWnd.Combo_GetCurSel("CmbType") == -1 || objWnd.Combo_GetCurSel("CmbType") == 0)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtLeft") * 1) == true || isNaN (objWnd.GetControlText("EdtDown") * 1) == true || isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
for (var X in WndCtrlId[WndLstTStSel])
{
if (WndCtrlId[WndLstTStSel].length > 0 && objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][X])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
}
}
}
}
}
// works fine :)
function OnWndWriterAddControlEvent_ComboSelChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtLeft") == "" || objWnd.GetControlText("EdtDown") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "" || objWnd.Combo_GetCurSel("CmbType") == -1 || objWnd.Combo_GetCurSel("CmbType") == 0)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtLeft") * 1) == true || isNaN (objWnd.GetControlText("EdtDown") * 1) == true || isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
for (var X in WndCtrlId[WndLstTStSel])
{
if (WndCtrlId[WndLstTStSel].length > 0 && objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][X])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
}
}
}
}
}
// gets it wrong :(
function OnWndWriterChangeControlEvent_EditTextChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtLeft") == "" || objWnd.GetControlText("EdtDown") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "" || objWnd.Combo_GetCurSel("CmbType") == -1 || objWnd.Combo_GetCurSel("CmbType") == 0)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtLeft") * 1) == true || isNaN (objWnd.GetControlText("EdtDown") * 1) == true || isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
for (var X in WndCtrlId[WndLstTStSel])
{
if (WndCtrlId[WndLstTStSel].length > 1 && objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][X])
{
if (objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][WndCtrlTStSel])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
}
}
}
}
// gets it wrong :(
function OnWndWriterChangeControlEvent_ComboSelChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtLeft") == "" || objWnd.GetControlText("EdtDown") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "" || objWnd.Combo_GetCurSel("CmbType") == -1 || objWnd.Combo_GetCurSel("CmbType") == 0)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtLeft") * 1) == true || isNaN (objWnd.GetControlText("EdtDown") * 1) == true || isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
for (var X in WndCtrlId[WndLstTStSel])
{
if (WndCtrlId[WndLstTStSel].length > 1 && objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][X])
{
if (objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][WndCtrlTStSel])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
}
}
}
}
This post was edited on 06-14-2009 at 02:30 PM by whiz.
|
|