Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Text input function. multiple lines and tab

Author
Message
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 19th Mar 2009 05:51
messing around and thought i'd make this.

works pretty well if i do say so myself.



well rem(ed) i think.

any questions or problems tell me

New Site! Check it out \/
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Mar 2009 07:26
Looks good, I can't test though I'm not on a PC.
Your REMs don't really need to be that descriptive, just state what the next section does you don't have to go into the ifs and buts unless its a tutorial. but anyway that's not really a criticism.

I think this might work better if you use scancode() to obtain the current key being pressed (including return, tab etc) and then taking the appropriate action instead of doing multiple if statements. Just a though I haven't practised it. Whatever you do, try and make it a bit shorter and faster its always good to make a function as simple and fast as you can before you start using it properly.

The Universe has been erased by a mod because it was larger
than 240x80 pixels.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 19th Mar 2009 20:18
well i wasn't sure who would see it on here and i figure ever 'remming' is better then peoople saying what does that do? lol

whats better about scancode? and how do obtain the scancode of each button(other then do print scancode() loop hahaha) so i can test for it in the function?


yes i am trying to shorten it now. and also make it so you can scroll through the characters. like you can in windows that way if you type Darkkbasic you don't have to delete all the way back to the k's to delete that one lol


i'm and trying to add as many features as possible because through together a little text editor because space invaders randomly stopped working and annoyed the crap outa me! lol

New Site! Check it out \/
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 19th Mar 2009 22:17
Yeah, it would be cool to see an example soon! This might be worth putting in the Program Announcements Board someday - if you perfect it!

~QJ
That's what they WANT you to think...
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 19th Mar 2009 23:26
yes i was hoping for that.

i have always been anoyed by having to use dbc input or having to whip together a cheap little input function.

theres a early example on my first post lol. thats about a half a days worth of work.


what do you all think should i store each character in a array so i can edit each on or should i just store the position of the cursor and then edit the string approprialtly?

New Site! Check it out \/
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 20th Mar 2009 00:02
Check this out.

It's a text editor made by Phaelax for DbPro. Doesn't work, so don't try to run it, but I thought you might want to look through it.

~QJ
That's what they WANT you to think...
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 20th Mar 2009 00:31
hm interesting! thanks!

it looks like he is using the sve position of the cursor idea. i'll work on this that will help me alot!

New Site! Check it out \/
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Mar 2009 01:28
@Caleb1994
Post an example of how to use the functions.

Be careful with including CLS and SYNC inside the function. While it's fine to do it, if your intention is to make a very general function, it may interfere with how people have their screens setup to redraw. I suppose you could include a bitmap parameter where everything is drawn to an offscreen bitmap then copied over to bitmap 1. That would allow you to do just about whatever you wanted display wise for your text without (hopefully) effecting the display the user has set up.

There was a text entry challenge in the DBC challenges from a while ago... There may be something interesting in there (I'm not talking about the fairly recent scrolling text challenge from which Phaelax elaborated to make the DBPro version)

Also, don't forget about TDK. If it's been thought about, he's probably done it or made an example! Take a look at this. It may give you some ideas:

Scrolling text box

Enjoy your day.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 20th Mar 2009 03:07
Oh ok here you go.

you just call Textinput



Left array key will put the cursor on the left so you can move hole lines or ad a tab. clicking above or below the current line will stop input

New Site! Check it out \/
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Mar 2009 03:31
Real nice! Can you slow or time the key repeat?

Enjoy your day.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 20th Mar 2009 06:46
i can add that very easily if you think it is needed?


wait i just realized something! i couldn't get timers to work right for some reason and so i used a counter getting incriminated by one every loop. so it depends on your sync rate! i can add that functionality though. i should be able to have that by tomorrow.

New Site! Check it out \/
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 20th Mar 2009 22:01 Edited at: 20th Mar 2009 22:03
Quote: "incriminated"


*facepalm*

It's INCreased and DECreased, not INCriminated or ?DECriminated?

lol'd

[/offtopic]

Anyways, yes I think that it needs either a timer() thing to control how many letters go down for each hold, or just add a switch.

Very nice, though!

EDIT:

Just noticed something: when I clicked my mouse and held it down, it shut me out! Dunno why...

~QJ
That's what they WANT you to think...
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Mar 2009 22:10
actually i think it really is increment or decrement but i just remember increase or decrease
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 20th Mar 2009 22:10
Whatever, it's not incriminate.

~QJ
That's what they WANT you to think...
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Mar 2009 22:17
true
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 20th Mar 2009 22:53 Edited at: 20th Mar 2009 22:57
if your refering to the fact that when you click the mouse you can't type anymore thats supposed to do that. thats the only way i could figure to end the input since it cant be return.

if you click above or below the line your typing on then it ends input


i know i need to switch to timer() i just forgot lol.



One thing though i realized me and no one else noticed that you can't position the input command hahahaha i will add that today lol.


[offtopic]

Quote: "INC
The INC command will increment a variable by a specified Value or by a default of 1. Both integer and real variables can be incremented by either an integer or real value.

SYNTAX
INC Variable
INC Variable, Value"


and
Quote: "
DEC
The DEC command will decrement a variable by a specified Value or by a default of 1. Both integer and real variables can be decremented by either an integer or real value.

SYNTAX
DEC Variable
DEC Variable, Value"



straight from db help granted i suck at spelling (really really bad) actually i just wasn't thinking. just typing hahaha

[/offtopic]

New Site! Check it out \/
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st Mar 2009 00:03
thats blatantly obvious, nvm tho, it doesnt matter wat it stands for, all that matters is wat it does
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 21st Mar 2009 00:21
yes i agree hahaha just making a point. i like to do that lol

New Site! Check it out \/
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st Mar 2009 00:24
ne1 else notice we got really off-topic?
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 21st Mar 2009 01:01
oh oh! me pick me! hahaha

New Site! Check it out \/
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st Mar 2009 01:10
lol, two more messages and were still off topic, ne1 wana end this cycle?
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 21st Mar 2009 01:46
Quote: "since it cant be return"


Why not?

IF RETURNKEY() = 1...

~QJ
That's what they WANT you to think...
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 21st Mar 2009 07:55
because return goes to the next line lol

New Site! Check it out \/
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 21st Mar 2009 16:17
Oh, you're using input?

~QJ
That's what they WANT you to think...
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 21st Mar 2009 18:45
no. this is a substitution for input. and returnkey goes to the next line

New Site! Check it out \/
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st Mar 2009 19:27
ty quirky, dangit im back off-topic, sorry
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 21st Mar 2009 23:31
Oh.

~QJ
That's what they WANT you to think...
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 22nd Mar 2009 02:20
ok well here's the newest update.


not much done but i made it so you can call how much the counters are inc by and set the key rate. here you go:




anything else (other then positioning the input and single character editing. working on that now)

New Site! Check it out \/

Login to post a reply

Server time is: 2025-05-16 20:36:15
Your offset time is: 2025-05-16 20:36:15