Adam D. Ruppe's Minigui using example

2019-08-17 Thread Andre Pany via Digitalmars-d-learn

https://forum.dlang.org/post/mumgkqopnsnowcmhi...@forum.dlang.org

On Saturday, 16 January 2016 at 03:14:01 UTC, Adam D. Ruppe wrote:
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");
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("");
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...


While searching for a minigui example in Google, you likely will 
find this old outdated example. Therefore I answer this very old 
post. Here a new example from Adam:



module menutest;
import arsd.minigui;

struct Info {
string name;
string email;
}

class MyWindow : MainWindow {
this() {
super("Menu Demo", 250, 400);
setMenuAndToolbarFromAnnotatedCode(this);
statusTip = "gnarley";
textEdit = new TextEdit(this);
auto hl = new HorizontalLayout(this);
auto btn = new Button("test", hl);
auto btn2 = new Button("test", hl);

btn.addEventListener("click", () {
messageBox("You clicked");
});

btn2.addEventListener(EventType.triggered, () {
dialog!Info((info) {
import std.conv;
textEdit.content = to!string(info);
});
});

textEdit.content = "generic content here";
}

TextEdit textEdit;

@menu("File") {
@toolbar("")
@icon(GenericIcons.New)
@accelerator("Ctrl+Shift+N")
void New() {
textEdit.content = "";
}
@toolbar("")
@icon(GenericIcons.Open)
@accelerator("Ctrl+O")
void Open() {
getOpenFileName( (string s) {
//import std.file;
//textEdit.content = (readText(s));
} );
}
@toolbar("")
@icon(GenericIcons.Save)
		void Save() @accelerator("Ctrl+S") { getSaveFileName( (string 
s) {} ); }

void SaveAs() {}
@separator
void Exit() @accelerator("Alt+F4") { this.close(); }
}

@menu("Edit") {
@toolbar("")
@icon(GenericIcons.Undo)
@accelerator("Ctrl+Z")
void Undo() {}
@toolbar("")
@icon(GenericIcons.Redo)
@accelerator("Ctrl+R")
void Redo() {}

Re: Adam D. Ruppe's Minigui using example

2016-01-23 Thread Andre Polykanine via Digitalmars-d-learn

On Saturday, 16 January 2016 at 03:14:01 UTC, Adam D. Ruppe wrote:
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:

[...]



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...


Thanks Adam,
I have DMD 2.068.2 so far so it did work.
However it seems to be not so accessible as I expected (tested 
with JAWS for Windows, latest release [1]). For instance, the 
focus lands nowhere when the program is launched. Then there is a 
(not too comfortable) possibility to make it show the elements to 
the screen reader upon pressing Tab.


[1]:https://en.wikipedia.org/wiki/JAWS_(screen_reader)


Adam D. Ruppe's Minigui using example

2016-01-15 Thread Andre Polykanine via Digitalmars-d-learn

Hi everyone,
I would like to use Minigui 
(https://github.com/adamdruppe/arsd/blob/master/minigui.d) and 
test it for accessibility.
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!


Re: Adam D. Ruppe's Minigui using example

2016-01-15 Thread Adam D. Ruppe via Digitalmars-d-learn
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");
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("");
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...