On Mon, 16 Sep 2013 22:36:00 GMT, det wrote:

guess i selected my example too simple ;) i will also need versions that check for floats and that the entered value falls within certain limits - so i do need the callback for d-side validation.

That's not surprising ;)

if there was a way to stop/kill any further propagation of the event or signal that made my Entry lose focus, then it should work (with grabFocus thereafter to reset the focus back to the Entry)... somehow running the error dialog has the positive side-effect of overriding/killing the [Ok]/[Cancel]-button-clicked-event. i would like to achieve the same without actually running the error dialog.

Maybe try something like this:

import gtk.Main, gtk.Label, gtk.Dialog, gtk.Entry, gtk.EditableIF;
import std.conv, std.stdio;

void main(string[] args){ 
	float f;

	Main.init(args); 

	auto dlg = new Dialog(
		"test",
		null,
		DialogFlags.MODAL,
		["OK", "Cancel"],
		[ResponseType.ACCEPT, ResponseType.CANCEL]
	);

	auto q = new Entry();
	q.setPlaceholderText("Some float");
	
	q.addOnChanged(delegate void(EditableIF e){
		try
		{
			f = to!(float)( q.getText() );
			dlg.getWidgetForResponse(ResponseType.ACCEPT).setSensitive(true);
			q.setStockId(EntryIconPosition.SECONDARY, StockID.DISCARD);
		}
		catch
		{
			dlg.getWidgetForResponse(ResponseType.ACCEPT).setSensitive(false);
			q.setStockId(EntryIconPosition.SECONDARY, StockID.DIALOG_ERROR);
		}
	});

	auto vbox = dlg.getContentArea();
	vbox.add( new Label("Entry:") );
	vbox.add( q );
	vbox.showAll();

	if( ResponseType.ACCEPT == dlg.run() ){
		writeln(f);
	}

	dlg.destroy();
}

(it does not help that having both, events AND signals, confuses me endlessly.)

Do you have an example?