I want the user to enter text in a text box, how can i do this? - processing

I want the user to enter text in a text box (such as a login text box on some site).
I tried to search in text() bibliography and other similar functions.

This guy seems to have figured it out: http://www.sojamo.de/libraries/controlP5/. Look for the textArea control.
If you don't like this, I read that the g4p library had something like an inputbox. Otherwise you will have to draw it yourself (which would be a nice exercise) using keyboard inputs and the like.

What you're describing is called a graphical user interface, or GUI. There are many ways to approach this problem:
Code it yourself. Use something like the rect() function to draw a text box, and the keyPressed() function to detect key presses.
Use a library. The Processing libraries page lists several GUI libraries. Try each of them out and see which one you like best.
Use a more general GUI library. If you're deploying as Java, then you might use Swing or JavaFX. If you're deploying as JavaScript, then you might use HTML elements.
Any of the above might work, and which approach you choose depends more on you, your context, and your preferences. We can't tell you which is best, because it's all up to what you prefer.

Related

Drawing popups in X11

I would like to draw a popup in X11. Something like the slider that appears in KDE and GNOME when you press volume or brightness control buttons. This is what it looks like in GNOME:
What library should I use to create such popups (unlike normal windows they should be without borders, etc. and possibly with some transparency)? Would be nice if there were bindings for Python.
This is done in GTK+. The easiest thing may be to find the code that creates that and copy what it does (my system has a different volume notifier, I'm not easily finding the code for that one).
Roughly what you'd do is create a GtkWindow, set_decorated(FALSE), set_position(GTK_WIN_POS_CENTER), something along those lines.
I'm not sure of the best set_type_hint(). Maybe TYPE_HINT_NOTIFICATION or TYPE_HINT_SPLASHSCREEN. If you do set the type hint, it may not be necessary to set_decorated or set_position since the type hint may imply those with many window managers.

keyboard functions in mathematica

I am trying to find out what keyboard functionalities Mathematica has. Would appreciate anyone to give some help. Specifically, I want to:
1) How to implement something like "press any key to continue..." behavior
2) How to accept user input?
Many thanks.
First, you'll want to look at Input and ChoiceDialog for something simple.
If you want to build your own interface, you can use the dynamic interactivity components with CreateDialog to construct a custom notebook dialog window to accept and return whatever kind of input you'd like.
You might find the Introduction to Control Objects and Generalized Input tutorials useful as well.

Interactive TextArea (collapsible bullet points)

I don't work with Graphical interfaces very much, most of my experience has been with Java. I realize the operating system provides some "native" controls that allow you to do things. What if I want to do things that are a little more fancy but feel like the native control?
What I'm thinking is having the simplicity of editing in a TextArea while provide the ability to collapse lists just like a tree. I would also like to be able to display text between lines that the user could click, it should be aligned under the right most text and be smaller.
I'm not thinking in terms of any language or GUI library. Just wondering how to go about creating something like this. Would I overlay some drawing onto the TextArea which would scroll with it? Would I use something like Cairo and build my own text field losing built in copy and paste...
What do other text editors use that allow them to fold code?
There is no universal solution to this. It varies depending on GUI. Every GUI has a different way of responding to user events such as mouse clicks, keyboard shortcuts, etc. There is no universal approach to this.

Read Text From Windows Form

I would like, if for no other reason that an academic exercise, to be able to read text written to a form on a Windows Application. The program appears to be written in non-.NET, but in .NET terms, I think you would describe the program as having a Form with a Label and I would like to read the text from that label.
I believe I can see that text being written to the screen with the User32!TextOut (and in other areas User32!DrawString) function. However, it would be nice if I didn't have to hook that function to get the information I'm looking for, but instead if I could just read it from the form directly.
So, given a handle to a Window, is it possible to read the text that has been written to that window with functions like TextOut and DrawString using some similar API or other clever means?
Or am I going about this the wrong way? Should I just hook the function and look for the text in every call and pray?
Thanks!
If the text is stored in the standard way on the control you can use SendMessage
Win32.SendMessage(controlHandle, Win32.WM_GETTEXTLENGTH, 0, null);
If the control was written with security in mind, the text is almost certainly not stored in a format that can be queried through the Windows API.
I used to use a program called Snadboy Revelation to grab forgotten passwords out of programs (that were just displaying as *****). Revelation uses the same technique. However, most modern software hides the text of password and similar fields so this is not of as much use these days.
UPDATE:
Found source code for a Windows Spy app.

Which widgets to use for a messenger

I'm currently learning to program Ruby with GUI. And has chosen wxruby. But has never used wxwidgets before. So my question is, which widgets do I use for the users list, the message list (scrolling) and the input area ?
Want to be able to choose font, color and use icons etc in the input area and the message list. And hoping to be able to have the userimage, nickname, status and smileys in the userlist also.
So anyone knows which to use?
For the input area and the message display, you'll probably want to use a wxRichTextCtrl, which will let you set fonts, colors, styles, etc. The main difference between the two is that the message display should be read-only. To change the style on the input area, you'll probably have wxButtons bound to functions to modify the style.
The userlist will probably be best off as a wxTreeCtrl, because you'll probably want to be able to have groups that you can expand. On the other hand, it might be a lot simpler to use a wxSimpleHtmlListBox because you will be able to use HTML to describe what you want to show, rather than having to worry about the finer details of another control.
For future reference, you might want to look at the Classes by Category page to help you figure out which controls you need, when you have an idea of what you're looking for.

Resources