How to use ResizerWidget in Dlangui app..?

ShadoLight ettienne.gilbert at
Mon Dec 30 23:32:37 UTC 2019


I suspect I'm missing something obvious, but ResizerWidget is not 
working for me on Windows - it shows the 'dragging'-cursor when 
hovering the mouse on the ResizerWidget, but dragging with the 
left mouse button does nothing.

Reduced very simple example:

import dlangui;
import gui;


/// entry point for dlangui based application
extern (C) int UIAppMain(string[] args) {
     // create window
     Window window = Platform.instance.createWindow("DlangUI 
example", null);

     //Make main layout
     auto mainGui = new GuiHandler();
     window.mainWidget = mainGui.makeGui(window);
     // show window;

     // run message loop
     return Platform.instance.enterMessageLoop();

/// gui.d
import dlangui;

class GuiHandler : ResizeHandler {

	Widget makeGui(Window w) {
		//Make main layout
		auto vlayout = new VerticalLayout();
		vlayout.margins = 20;
		vlayout.padding = 10;ets
		vlayout.backgroundColor = 0xFFFFC0;

		// Layout for editors
		auto editorsLayout = new LinearLayout();
		editorsLayout.orientation = Orientation.Vertical;
		//Make edit + trace windows
		auto editor = new EditBox();
		auto resizer = new ResizerWidget();
//		resizer.resizeEvent.connect(this); //Connect for handling 
events in onResize.
		auto tracer = new LogWidget();
		return vlayout;
	override void onResize(ResizerWidget source, ResizerEventType 
event, int currentPosition) {
              //Not shown...

I searched through all the dlangui examples where ResizerWidget 
is used, and none of them provides any onResize event handler as 
shown above. But, since none of them work (symptoms exactly the 
same as mine), I am wondering if this is required?

Also checking in DlanguiIDE - nowhere does it implements the 
onResize event handler for ResizerWidget either. I find this a 
bit odd - in none of the projects where ResizerWidget are used 
does it work, but none of these projects provide the onResize 
event handler either.  Which makes me suspect it is supposed to 
work 'out of the box' and does not require the event handler for 
the basic dragging functionality - similar how resizing the whole 
window works without requiring that you implement it yourself in 
the OnResize event handler for the main Widget. Also - I can 
hardly believe that Vadim would have kept putting it in examples, 
but without it working, so I suspect some regression here if I am 
not doing something stupid myself (which is always possible!).

There are plenty of 'deprecated' warnings when building dlangui 
and, since dlangui has not been updated since 2018, I'm concerned 
it may be breaking with new versions of the compiler.

Alternatively I'm missing something elementary here..? Has anyone 
used ResizerWidget successfully with a recent version of the 
compiler on Windows?

win 7
DMD32 D Compiler v2.089.1

More information about the Digitalmars-d-learn mailing list