Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WindowSystemObject (WSO) OnClick error
#1
Hi, I've tried to solve this on my own for days without luck. I am trying to use WSO (WindowSystemObject) web page here. It's very interesting to me as it has a designer for GUIs that I've had some luck with already with LA. The problem I'm having is with its event handlers. These event handlers work fine in Python, JScript, VBScript, and Delphi, but so far (at least for me) not with LA. I've tried to narrow down the problem with a simple script (below). It just creates a form with a button. LA's IntelliSense correctly reports the button's methods and properties, and many attributes such as width and height of buttons can be changed in LA. The offending linehas 'OnClick' underlined in red when not commented out, and the error message is this: "Error: Ambiguity between 'IControlEvents_Event.OnClick' and 'IButton.OnClick'
 
Code:
Copy      Help
(button.OnClick = (o, e) => print.it("Clicked");)

IControlEvents_OnClickEventHandler IControlEvents_Event.OnClick". I've been unable to use the 'button +=' syntax to add a handler, and don't believe that will ever work (hope I'm wrong).

The COM Dll (wso.dll) is properly registered on my system as 64-bit. I am able to work with it successfully in Python, JScript, and VBScript, with no event handler problems. It works pretty well in AutoHotkey also. A supplied Delphi test app also works fine on my system. I'm unsure of where to go from here, and would love some help.



Code:
Copy      Help
/*/ com WSOLib 1.0 #c20d9213.dll; c .\WSOConsts2.cs; /*/
using WSOLib;

partial class Program {
    [STAThread]
    static void Main(string[] args) {
        dynamic wso = ComUtil.CreateObject("Scripting.WindowSystemObject");
        wso.EnableVisualStyles = true;
        
        dynamic form = wso.CreateForm(0, 0, 0, 0);
        
        form.ClientWidth = 150;
        form.ClientHeight = 100;
        form.CenterControl();
        
        WSOLib.Button button = form.CreateButton(10, 10, 75, 25, "Close");
        button.Font.Size = 10;
        button.Font.Name = "Comic Sans MS";
        // button.OnClick = (o, e) => print.it("Clicked"); // This is the line causing trouble.
        form.Show();
        
        wso.Run();
    }
}

As you can see I'm also using a file with constants, but those are not being used in this code.

Best regards,
burque505
#2
Google search results suggest that nobody uses this software in C#. It is for programming languages that don't have a UI framework. In C# can be used winforms and WPF. This software looks similar to winforms. Docking libraries for winforms and WPF exist, although may be bloated and difficult.
#3
Thanks, Gintaras. I'll punt on it for now.
Best,
burque505


Forum Jump:


Users browsing this thread: 1 Guest(s)