Code:
Problem description:
All of the tutorials I see insist on using editors and such to make a Window to house two Panes.... but I am wondering if it can be done in code
I am trying to create two panes inside a main window, split vertically... is it impossible to do this using only code?
ID:2041263
Feb 20 2016, 6:31 pm
|
|
Creating or deleting controls at runtime
Controls in a window or pane can be added or deleted at runtime. (Only controls you add at runtime can be deleted.) To create a control, you need to supply a parent parameter with the ID of the window or pane that will hold the control, and type which is one of the available control types.
var/list/params = new
params["parent"] = "mywindow"
params["type"] = "button"
params["text"] = "New button"
params["command"] = "say \"This is a new button.\""
params["pos"] = "10,10"
params["size"] = "80x20"
params["anchor1"] = "0,0"
winset(usr, "newbutton", list2params(params))
The ID of this button will be newbutton, which in full form is mywindow.newbutton.
Note: At the present time, adding a control will not work through the .winset command that can be used in macros or menus, or typed in an input box. Only using the winset() proc inside the program's code will work.
Controls that were added this way can also be deleted again by setting their parent to a blank value.