Page 1 of 1
A text box control
Posted: Sun Sep 14, 2008 8:13 pm
by Kaze
Been working on this for a little while, still some things to do, but ehh.
Shitty screenshot:
It supports selection (with the mouse, arrow keys(while holding shift), and ctrl+a).
Functions:
Code: Select all
SetWidth
GetWidth
SetHeight
GetHeight
SetFocus
GetFocus
SetValue
GetValue
SetColorFG
SetColorBG
SetCurPos
GetSelected
DeleteSelected
Clear
Append
AppendAfterCursor
Calls (Overwrite these functions for whatever):
Demo (Changes text when you press enter):
Coming soon:
- Multiline
- Different font support
- ?? Suggestions welcome.
* Note that I didn't copy Zeddy's text box (console), the only thing I used from his was the key-repeating stuff (Thanks Zeddy). Everything else is all me.
* Also, the most of the keys are mapped to my keyboard (which is IRISH). (Symbols and such)
Re: A text box control
Posted: Sun Sep 14, 2008 9:20 pm
by Kuromeku
Absolutely amazing. When I code the controls library for kudoLib, don't be thinking I copied your code though
You know what it needs? When you hover over the entry the cursor changes to the little I, that'd be easy
Also, make it so when you hold control and use the arrow keys the cursor jumps by words instead of letters.
Re: A text box control
Posted: Sun Sep 14, 2008 11:26 pm
by Kaze
Kudomiku wrote:You know what it needs? When you hover over the entry the cursor changes to the little I, that'd be easy
Will do.
Kudomiku wrote:Also, make it so when you hold control and use the arrow keys the cursor jumps by words instead of letters.
Didn't even know text boxes in windows did that, will do also.
Re: A text box control
Posted: Sun Sep 14, 2008 11:47 pm
by Kuromeku
Well it jumps to the before the next space or symbol in that direction as long as the next character isn't a symbol also.
Play with it to see how it works.
Re: A text box control
Posted: Mon Sep 15, 2008 9:50 pm
by surtic
Looks great!
Personally I find the blinking selection a bit irritating (blinking stuff almost always irritates me).
Also, the movement is a bit slow (compare to a standard applicaton - the cursor moves pretty slowly).
Other than that - very nice and very usable.
Re: A text box control
Posted: Wed Sep 17, 2008 7:36 pm
by SnakeFace
Looks nice. If you could compress it down to a smaller amount of code it'd be nicer to fit in places.
Re: A text box control
Posted: Thu Sep 18, 2008 2:30 am
by Kaze
surtic wrote:Looks great!
Personally I find the blinking selection a bit irritating (blinking stuff almost always irritates me).
Also, the movement is a bit slow (compare to a standard applicaton - the cursor moves pretty slowly).
Other than that - very nice and very usable.
I'll add some options for key repeat speed, and blinking, I guess.
For now - just edit them yourself.
Line 49 is where you can turn off the blinking.
Code: Select all
love.graphics.setColor(0xEE, 0xEE, 0xEE, util.Pulse(0xFF, 0, 3))
Line 87 is where you can change the key repeat speed, line 100 is for the delay before they start to repeat.
SnakeFace wrote:Looks nice. If you could compress it down to a smaller amount of code it'd be nicer to fit in places.
?.. It's only 16kB.
Remove the comments, either manually, or with a regular expression:
In Notepad++, replace (all) (with regular expressions selected)
with nothing.. Will reduce size by 3kB. :lol: