Răsfoiți Sursa

fixes for onActivate()

Nicolas Cannasse 6 ani în urmă
părinte
comite
b755dd6cd8
2 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 2 1
      hide/comp/cdb/Cursor.hx
  2. 7 0
      hide/ui/View.hx

+ 2 - 1
hide/comp/cdb/Cursor.hx

@@ -11,6 +11,7 @@ class Cursor {
 
 	public function new(editor) {
 		this.editor = editor;
+		set();
 	}
 
 	public function set( ?t, ?x=0, ?y=0, ?sel, update = true ) {
@@ -60,7 +61,7 @@ class Cursor {
 
 	public function move( dx : Int, dy : Int, shift : Bool, ctrl : Bool ) {
 		if( table == null )
-			return;
+			table = editor.tables[0];
 		if( x == -1 && ctrl ) {
 			if( dy != 0 )
 				editor.moveLine(getLine(), dy);

+ 7 - 0
hide/ui/View.hx

@@ -120,6 +120,9 @@ class View<T> extends hide.comp.Component {
 			}
 			destroy();
 		});
+		container.on("show", function(_) {
+			haxe.Timer.delay(onActivate,0);
+		});
 		container.getElement().keydown(function(e) {
 			processKeyEvent(e);
 		});
@@ -163,6 +166,10 @@ class View<T> extends hide.comp.Component {
 		return false;
 	}
 
+	function toString() {
+		return Type.getClassName(Type.getClass(this)) + (this.state == null ? "" : "("+haxe.Json.stringify(this.state)+")");
+	}
+
 	/**
 		Gives focus if part of a tab group
 	**/