problem with opIndex

2017-09-29 Thread Joseph via Digitalmars-d-learn
I am trying to have a multi-dimensional array and opIndex has to have both an arbitrary number of parameters and allow for slicing. The problem is if I create opIndex for non-slicing, it looks like ref auto opIndex(T...)(T index) and this one catches all templates. But slices do not return

opDollar any

2017-09-29 Thread Joseph via Digitalmars-d-learn
Trying to do multi-dimension array but op-dollar doesn't seem to support arbitrary dimensions @property int opDollar(size_t dim : k)() { return dims[k]; }

Detect if variable defined

2017-09-29 Thread Joseph via Digitalmars-d-learn
static if () { enum x; } static if (isDefined!x) { } What's the correct way to check if a variable has been defined? (note x may or may not be defined above. I need to know if it is)

Re: How to get DnD to work in GTKD?

2017-09-21 Thread Joseph via Digitalmars-d-learn
On Friday, 22 September 2017 at 02:57:32 UTC, Joseph wrote: On Saturday, 16 September 2017 at 14:33:53 UTC, Mike Wey wrote: On 16-09-17 06:33, Joseph wrote: I've used null in place of [te]. I'm not sure what target entry is for and if that is the problem or what. I am trying to drag files

Re: How to get DnD to work in GTKD?

2017-09-21 Thread Joseph via Digitalmars-d-learn
On Saturday, 16 September 2017 at 14:33:53 UTC, Mike Wey wrote: On 16-09-17 06:33, Joseph wrote: I've used null in place of [te]. I'm not sure what target entry is for and if that is the problem or what. I am trying to drag files from windows explorer to a grid or label(I duplicated the

Re: Gtk toArray List funkiness

2017-09-16 Thread Joseph via Digitalmars-d-learn
On Saturday, 16 September 2017 at 20:54:21 UTC, Mike Wey wrote: On 16-09-17 20:58, Joseph wrote: https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/TestWindow/TestWindow.d has the code foreach ( int i, string selection ; fs.getSelections()) {   writeln("File(s) selected [%d]

Gtk toArray List funkiness

2017-09-16 Thread Joseph via Digitalmars-d-learn
https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/TestWindow/TestWindow.d has the code foreach ( int i, string selection ; fs.getSelections()) { writeln("File(s) selected [%d] %s",i,selection); } which is invalid for the demo, but foreach ( int i, string selection ;

Re: How to get DnD to work in GTKD?

2017-09-16 Thread Joseph via Digitalmars-d-learn
On Saturday, 16 September 2017 at 17:08:52 UTC, Joseph wrote: On Saturday, 16 September 2017 at 14:33:53 UTC, Mike Wey wrote: On 16-09-17 06:33, Joseph wrote: [...] You will also need to set an TargetList to tell gtk that you want to receive text: ``` TargetList lst = new TargetList([]);

Re: How to get DnD to work in GTKD?

2017-09-16 Thread Joseph via Digitalmars-d-learn
On Saturday, 16 September 2017 at 14:33:53 UTC, Mike Wey wrote: On 16-09-17 06:33, Joseph wrote: I've used null in place of [te]. I'm not sure what target entry is for and if that is the problem or what. I am trying to drag files from windows explorer to a grid or label(I duplicated the

How to get DnD to work in GTKD?

2017-09-15 Thread Joseph via Digitalmars-d-learn
This is my code: TargetEntry te = new TargetEntry("test", GtkTargetFlags.OTHER_APP, 0); w.dragDestSet(GtkDestDefaults.ALL, [te], GdkDragAction.COPY); w.addOnDragDataReceived((dragContext, x, y, selectionData, info, time, widget) { writeln("ok1"); }); w.addOnDragDrop((dragContext, x, y,

Binary serialization of a struct

2017-09-15 Thread Joseph via Digitalmars-d-learn
Are there any simple direct serialization libraries where I can mark elements of a class or struct that I want serialized with an attribute and it will take care of all the rest(including recursive structures, arrays, etc) then deserialize back in to the structs? I want something straight

Re: How to check if path is writable

2017-09-14 Thread Joseph via Digitalmars-d-learn
On Friday, 15 September 2017 at 02:02:54 UTC, Neia Neutuladh wrote: On Friday, 15 September 2017 at 01:42:02 UTC, Joseph wrote: Is there a cross-platform way in D to check if a path is writable? Try to write to it and see if you get an error. Um, so I have to do this for every platform? I

How to check if path is writable

2017-09-14 Thread Joseph via Digitalmars-d-learn
Is there a cross-platform way in D to check if a path is writable?

Re: Adding empty static this() causes exception

2017-09-12 Thread Joseph via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 10:08:11 UTC, Moritz Maxeiner wrote: On Tuesday, 12 September 2017 at 09:11:20 UTC, Joseph wrote: I have two nearly duplicate files I added a static this() to initialize some static members of an interface. On one file when I add an empty static this() it

Adding empty static this() causes exception

2017-09-12 Thread Joseph via Digitalmars-d-learn
I have two nearly duplicate files I added a static this() to initialize some static members of an interface. On one file when I add an empty static this() it crashes while the other one does not. The exception that happens is Cyclic dependency between module A and B. Why does this occur on

GtkD mouse latency issues

2017-09-10 Thread Joseph via Digitalmars-d-learn
I have a GTK paned element and when I click to drag the handler, it does not respond immediately. I have to hold the left mouse button down for about 1 second and not move it before it "catches" and lets me drag, else I does not move. I'm using Glade and the most simple example of a paned