On Friday, 20 October 2023 at 20:43:21 UTC, Felipe Lema wrote:
> I don't mind using any or other GUI framework, but I do aim to have a windows-exe-with-as-few-dlls-as-possible
My minigui.d can do this fairly easily:
import arsd.minigui;
void main() {
// need to define the data you want in a struct,
// it requires a struct even if you only want one item
struct Data {
string code;
}
// then do the dialog function with the struct and it
// auto-creates a dialog for all the parts of the struct
// and calls the function you provide when the user hits OK
dialog((Data received) {
// you got the number here
messageBox("You gave me " ~ received.code);
// note that if they hit cancel, this function is NOT
// called, the dialog is just closed without running
// this code.
});
// need to run the event loop explicitly, this will return when
// all windows are closed
EventLoop.get.run();
}
If you use dub you can add it as dependency:
https://code.dlang.org/packages/arsd-official%3Aminigui
arsd-official:minigui
If you don't use dub, it needs about 6 files out of the repo, but i suggest you clone the whole thing then use dmd -i.
But anyway, on Windows it uses the native text box so there's no dlls needed. On Linux, it uses my full custom stuff so no libs required there either.