A text box control

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Kaze
Party member
Posts: 189
Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland

A text box control

Post by Kaze »

Been working on this for a little while, still some things to do, but ehh.

Shitty screenshot:
Image

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):

Code: Select all

OnEnter
OnTab
OnRightClick
Demo (Changes text when you press enter):
Image

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)
Last edited by Kaze on Sun Sep 14, 2008 11:30 pm, edited 1 time in total.
User avatar
Kuromeku
Party member
Posts: 166
Joined: Sun Jul 20, 2008 5:45 pm

Re: A text box control

Post 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.
User avatar
Kaze
Party member
Posts: 189
Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland

Re: A text box control

Post 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.
User avatar
Kuromeku
Party member
Posts: 166
Joined: Sun Jul 20, 2008 5:45 pm

Re: A text box control

Post 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.
surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Re: A text box control

Post 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.
SnakeFace
Prole
Posts: 28
Joined: Tue Aug 19, 2008 2:45 pm

Re: A text box control

Post by SnakeFace »

Looks nice. If you could compress it down to a smaller amount of code it'd be nicer to fit in places.
Lovely quotes
somewhere within the jungle of administrative doom - rude
User avatar
Kaze
Party member
Posts: 189
Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland

Re: A text box control

Post 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.

Code: Select all

if self._KeyRepeatTime > 110 then
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)

Code: Select all

--(.*)
with nothing.. Will reduce size by 3kB. :lol:
Post Reply

Who is online

Users browsing this forum: No registered users and 145 guests