On Saturday, 16 February 2019 at 16:28:09 UTC, Ron Tarrant wrote:
On Saturday, 16 February 2019 at 14:29:56 UTC, Russel Winder wrote:

Pass, sorry.

Thanks for the replies, guys...

I quoted the above line because it's just about the only thing I understood. Let me explain...

It's been almost 20 years since I used Linux and my notes are long gone. A ton of things have changed. Like, for instance, it found all my hardware this time, without me getting involved. But also the software installation managers and lots of other things are completely unrecognizable. On top of that, my brain has (unfortunately) been molded into the Windows/Microsoft way of thinking.

I guess what I'm hoping for is a step-by-step, full-on-hand-holding, large-print with pictures tutorial for how to get GtkD and (I guess) dub working. I know the stuff you wrote is probably helpful, but I'm not well-enough versed in Linux or any flavour of UNIX ATM to understand it, pick which option I should use, and to put these commands in proper order.

So far, as I said, dmd is working. Up until now, I've avoided dub because, with so many code examples (more than 70 at present) dub would bring in a lot of file/directory clutter.

But you're saying that dub will make it easier to keep up with future changes/updates in all the various bits and bobs, so if that means I finally have to do dub, perhaps someone could point me at a good tutorial for that?

Sorry if I sound ungrateful or cranky, but I have a lot on my plate ATM and I'm getting frustrated.

Hi Ron,

For one-file programs, dub usage is very easy.

Placing a minimal comment-header between /+ +/ symbol comments, gets your job done like in this example ( I think the gtkd code is from one of your examples in the blog):

/+
 dub.sdl:
 --------
 name       "gtkhello"
 dflags     "-dip25" "-dip1000"
 dependency "gtk-d:gtkd" version="~>3.8.0"
 +/

/*
  dub run --single gtkhello.d
  dub build --single gtkhello.d.
  dub gtkhello.d <arguments to hello>.
*/


module gtkhello;

import std.stdio;
import gtk.MainWindow;
import gtk.Main;
import gtk.Widget;
import gtk.Layout;
import gtk.Button;
import gdk.Event;

void main(string[] args)
{
  Main.init(args);
  TestRigWindow myTestRig = new TestRigWindow("Test Rig");
  myTestRig.showAll();
  Main.run();

} // main()


class TestRigWindow : MainWindow
{
  this(string title)
  {
    // window
    super(title);
    addOnDestroy(delegate void(Widget w) { quitApp(); } );

    auto myButton = new MyButt("Button Name");
    auto myOtherButton = new MyOtherButt("Other Button Name");

    // layout
    auto myLayout = new MyLayout(myButton, myOtherButton);
    add(myLayout);

  } // this() CONSTRUCTOR


  void quitApp()
  {
    writeln("Bye.");
    Main.quit();

  } // quitApp()

} // class myAppWindow


class MyLayout : Layout
{
  this(MyButt myButton, MyOtherButt otherButton)
  {
    super(null, null);
    put(myButton, 10, 20);
    put(otherButton, 10, 60);

  } // this()

} // class MyLayout


class MyButt : Button
{
  this(string labelText)
  {
    super(labelText);
    addOnButtonRelease(&doSomething);

  } // this()


  bool doSomething(Event e, Widget w)
  {
    writeln("Something was done.");

    return(true);

  } // doSomething()

} // class MyButt


class MyOtherButt : Button
{
  this(string labelText)
  {
    super(labelText);
    string message = "Something other than that was done.";
    addOnClicked(delegate void(_) { doSomething(message); } );

  } // this()


  void doSomething(string messageText)
  {
    writeln(messageText);

  } // doSomething()

}
---

Antonio

Reply via email to