Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use mouse to focus more than one textbox #406

Open
voltuer opened this issue May 26, 2020 · 5 comments
Open

Can't use mouse to focus more than one textbox #406

voltuer opened this issue May 26, 2020 · 5 comments

Comments

@voltuer
Copy link

voltuer commented May 26, 2020

Hi, so I have 2 textboxes and I'm trying to type text on both of them. When I click the first it works fine, but when I click on the second box, the cursor stays on the first one and typing text makes the first box to add every letter twice and the second doesn't add anything.

Code is here:

var blessed = require('blessed')
var screen = blessed.screen({
  smartCSR: true,
  title: 'La Pachala'
});
var form = blessed.form({
  parent: screen,
  width: '90%',
  left: 'center',
  keys: true,
  vi: true
});

var firstName = blessed.textbox({
  parent: form,
  name: 'firstname',
  top: 4,
  left: 5,
  height: 3,
  inputOnFocus: true,
  content: 'first',
  border: {
    type: 'line'
  },
  mouse: true
});

var xd = blessed.textbox({
  parent: form,
  name: 'xd',
  top: 8,
  left: 5,
  height: 3,
  inputOnFocus: true,
  content: 'xd',
  border: {
    type: 'line'
  },
  mouse: true
});

screen.key('q', function () {
  this.destroy();
});
screen.render();

Also, some times when pressing tab the program crashes with

TypeError: done is not a function
@AngeloMateus
Copy link

I'm getting this as well, I think the library just isn't being updated anymore.

@voltuer
Copy link
Author

voltuer commented Jun 13, 2020

@AngeloMateus I think I just fixed in in my fork

@mcbridet
Copy link

mcbridet commented Oct 1, 2020

@tr4g Your fork doesn't exist any more. Do you still have a snippet that fixes the problem?

@pinheadmz
Copy link

Anyone have a patch for this?

@pinheadmz
Copy link

Ok, this worked for me:

diff --git a/lib/widgets/textarea.js b/lib/widgets/textarea.js
index dc94609..9813867 100644
--- a/lib/widgets/textarea.js
+++ b/lib/widgets/textarea.js
@@ -172,9 +172,9 @@ Textarea.prototype.readInput = function(callback) {
       self.screen.restoreFocus();
     }
 
-    if (self.options.inputOnFocus) {
-      self.screen.rewindFocus();
-    }
+    // if (self.options.inputOnFocus) {
+    //   self.screen.rewindFocus();
+    // }
 
     // Ugly
     if (err === 'stop') return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants