Adam D. Ruppe's Minigui using example
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 15 19:14:01 PST 2016
On Saturday, 16 January 2016 at 01:27:32 UTC, Andre Polykanine
wrote:
> Does anyone have an actual example of, say, a simple form with
> a set of radio buttons or check boxes to start with?
> Thanks in advance!
Sort of. I still haven't used it in a real world program so it
isn't complete but here's one of my test programs:
---
import arsd.minigui;
void main() {
auto window = new MainWindow();
auto exitAction = new Action("E&xit");
exitAction.triggered ~= { window.close(); };
window.statusTip = "D ROX!";
auto button = new Checkbox("Uses D!", window);
button.isChecked = true;
auto hlayout = new HorizontalLayout(window);
auto gb = new Fieldset("Type", hlayout);
auto gb2 = new Fieldset("cool", hlayout);
auto boxlol1 = new Radiobox("Test", gb);
auto boxlol2 = new Radiobox("Test2", gb2);
auto boxlol3 = new Radiobox("Test", gb);
auto boxlol4 = new Radiobox("Test2", gb2);
auto group = new MutuallyExclusiveGroup();
group.addMember(new Radiobox("Heavyweight", gb));
auto btn = group.addMember(new Radiobox("Small library",
gb));
btn.isChecked = true;
btn.statusTip = "205 KB exe on Windows";
//auto spinner = new Spinner(window);
ComboboxBase cb = new DropDownSelection(window);
cb.addOption("test");
cb.addOption("cool");
cb.setSelection(1);
//cb.addEventListener("changed", (Event ev) {
//auto bm = new MessageBox("changed " ~
cb.options[cb.selection]);
//});
// FIXME: adding this to gb2 instead of window causes wtf
stuff
cb = new ComboBox(window);
cb.addOption("test");
cb.addOption("cool");
cb.setSelection(1);
cb = new FreeEntrySelection(window);
cb.addOption("test");
cb.addOption("cool");
cb.setSelection(1);
auto lineEdit = new LineEdit(window);
auto menu = new MenuBar();
auto fileMenu = new Menu("&File");
auto exitButton = fileMenu.addItem(new
MenuItem(exitAction));
menu.addItem(fileMenu);
window.loop();
}
---
On Windows, it uses the native controls, so it should work
reasonably well, though on Linux it does its own thing and is far
from complete.
BTW simplewindow doesn't seem to compile on newest dmd because of
the new core.sys.windows.windows so I'll have to update that if
you're on the newest release...
More information about the Digitalmars-d-learn
mailing list