quote:
Originally posted by SmokingCookie
As in .NET programming? Like MyForm.BtnHello = new Button(); or something?
Perhaps not actually creating controls, but acquiring an object with control-specific methods, properties and ideally events as well.
js code:
var MyWnd = MsgPlus.CreateWnd("Interfaces.xml", "MyWnd");
// Acquire control object for a ListViewControl
var LvFiles = MyWnd.GetControl("LvFiles");
// Methods
LvFiles.AddItem("alpha.txt");
LvFiles.AddItem("beta.txt");
// Properties
Debug.Trace("Item count: "+LvFiles.ItemCount); // = 2
// Events
LvFiles.AddEventHandler("Clicked", OnLvFilesEvent_Clicked);
LvFiles.AddEventHandler("SelStateChange", function(ItemIdx, SelectedState) {
Debug.Trace("Item #"+ItemIdx+" selection state changed to "+SelectedState);
Debug.Trace("Item data: " + this.GetItemData(ItemIdx) );
});
Of course, all of this is nothing more than an early proposal. Here are my thoughts:
- I believe it would be better to pass event callbacks as function objects instead of function names to prevent global scope saturation.
- The "this" context inside the event callback could be set to the control object. By doing so, you don't need to pass PlusWnd and ControlId as parameters to the function, you could access everything through the control object itself. If you still need the window or the control ID, the control object could have properties such as Control:arent and Control::ControlId.
I don't say it has to be this way, it's just something which could be considered.
quote:
Originally posted by NanaFreak
how about much better dynamic window support? like not having to have it as a xml then edit the xml to change the window?
Certainly, I believe that the new scripting environment should provide sufficient window and control support to remove the need of in-runtime XML rewriting. Matty has already informed me that this is high on his wish list. CodeEditControls and MenuButtonControls urgently need an API - they simply cannot be modified through code in Plus! 4. Ideally, methods could be added to natively (without Win32 API) handle DateTimeControls, HotkeyControls, ProgressControls, ScrollBarControls, SliderControls, SpinControls and TreeViewControls.