From d2afc5bc00ba9ab55c5586d0bf850cd5803104fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Wed, 7 Sep 2016 20:08:36 +0000 Subject: [PATCH] [GB.GTK] * BUG: TextBox: Make SetFocus() not select the text. [GB.GTK3] * BUG: TextBox: Make SetFocus() not select the text. git-svn-id: svn://localhost/gambas/trunk@7899 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.gtk/src/gtextbox.cpp | 11 +++++++++++ gb.gtk/src/gtextbox.h | 1 + 2 files changed, 12 insertions(+) diff --git a/gb.gtk/src/gtextbox.cpp b/gb.gtk/src/gtextbox.cpp index fc491ca36..fb01cb8d0 100644 --- a/gb.gtk/src/gtextbox.cpp +++ b/gb.gtk/src/gtextbox.cpp @@ -505,3 +505,14 @@ void gTextBox::getCursorPos(int *x, int *y, int pos) *x = px + PANGO_PIXELS(rect.x); *y = py + PANGO_PIXELS(rect.y + rect.height); } + +void gTextBox::setFocus() +{ + bool r = isReadOnly(); + + if (!r) + setReadOnly(true); + gControl::setFocus(); + if (!r) + setReadOnly(false); +} diff --git a/gb.gtk/src/gtextbox.h b/gb.gtk/src/gtextbox.h index 9f3f3a6e2..2ba31c1b0 100644 --- a/gb.gtk/src/gtextbox.h +++ b/gb.gtk/src/gtextbox.h @@ -55,6 +55,7 @@ public: //"Methods" virtual void clear(); + virtual void setFocus(); void insert(char* txt,int len); void selClear(); void select(int start,int len);