Jump to content


Photo

Multiple Textboxes


  • Please log in to reply
26 replies to this topic

#1 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 24 April 2011 - 01:20 PM

a9wh9s.pngby Saru

To use, you must call init code from Game Start or Create event once (more times is just a memory waste). "gui_textbox_create(...)" has to be called only once to create a textbox. They do not require much customization. Other scripts, added in version 1.1 or later version are optional to use.

Quote
It is open-source. Do whatever you want with it, change it, use it, but if you want to publish it, leave me a credit and PM me a link to your product/topic..



Quick description: Working, advanced, visually impressive textbox engine with easy implementation! Few scripts, ready to export/import, creating reliable textbox. You can change color, limit value's length and much more. Also the text won't be drawn outside of the region. Scripts handle all operations you may need to do, for example set depth, set whether visible or get value. Try now and leave feedback! Version 1.4 will bring many great updates, you all may once use! Check changelog for more info - it just got serious with 1.4!

 

POST YOUR IDEAS WHAT SHOULD I ADD. -But check changelog if they weren't already added!

Downloads:

Changelog: (Click to see all/new features!!!)

Spoiler

Edited by Saruwatari, 01 April 2013 - 03:19 PM.

  • 4

#2 whoisit

whoisit

    Always Learning

  • New Member
  • 242 posts
  • Version:GM8

Posted 27 April 2011 - 09:49 AM

It's nice and it does the job, one fault if you press the # key it jumps out of the text box and on to the next line.
  • 0

#3 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 27 April 2011 - 07:20 PM

It's nice and it does the job, one fault if you press the # key it jumps out of the text box and on to the next line.

It's not really heard to fix it. Gonna upload new version.

EDIT: Updated to version 1.2! You can find it in first post!

Edited by Saruwatari, 27 April 2011 - 08:35 PM.

  • 0

#4 whoisit

whoisit

    Always Learning

  • New Member
  • 242 posts
  • Version:GM8

Posted 27 April 2011 - 09:16 PM

Had to give you a rep point for the quick fix!!

The more I've looked at it the better it's become, so much so that I will be using it in my next project ;)
The amount of users on here who have asked for a text box should make this quite a popular script.
Well Done!

How do I fill the value of a textbox with a varaible

ie tetbox1.value=myvalue

This works but then if I click on the box I get this
Error in code at line 12:
   if mouse_check_button_pressed(mb_left) {    if mouse_x>x && mouse_y>y && mouse_x<x+width && mouse_y<y+20 {active=true; keyboard_string=value;}    else {active=false}}draw_set_color(c_white);draw_rectangle(x-1,y-1,x+width+1,y+20+1,true);draw_set_color(c_black)draw_rectangle(x,y,x+width,y+20,true);draw_set_font(text_font);draw_set_color(c_black);if active=true {draw_text(x+3,y+2,draw_value+cursor);} else {draw_text(x+3,y+2,draw_value);}draw_value=value;if active=false exit;if string_length(keyboard_string)>maxlength {    keyboard_string=string_delete(keyboard_string,string_length(keyboard_string),1);}value=keyboard_string;draw_value=value;if string_width(draw_value)>width-8 {    do {draw_value=string_delete(draw_value,1,1)} until string_width(draw_value)<=width-8;}
                                               ^
at position 46: Wrong type of arguments to +.

Edited by whoisit, 27 April 2011 - 09:35 PM.

  • 0

#5 whoisit

whoisit

    Always Learning

  • New Member
  • 242 posts
  • Version:GM8

Posted 28 April 2011 - 01:40 PM

Here's the problem in a create event

gui_textbox_init();
textbox1=gui_textbox_create(100,100,c_red,250,3,"",false); //textbox 1
myvalue=345
textbox1.value=(myvalue)

Now when you click on textbox1 you get this error
ERROR in
action number 1
of Draw Event
for object __newobject3:

Error in code at line 12:
   if active=true {draw_text(x+3,y+2,draw_value+cursor);} else {draw_text(x+3,y+2,draw_value);}
                                                ^
at position 47: Wrong type of arguments to +.

  • 0

#6 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 28 April 2011 - 03:07 PM

Here's the problem in a create event

gui_textbox_init();
textbox1=gui_textbox_create(100,100,c_red,250,3,"",false); //textbox 1
myvalue=345
textbox1.value=(myvalue)

Now when you click on textbox1 you get this error
ERROR in
action number 1
of Draw Event
for object __newobject3:

Error in code at line 12:
   if active=true {draw_text(x+3,y+2,draw_value+cursor);} else {draw_text(x+3,y+2,draw_value);}
                                                ^
at position 47: Wrong type of arguments to +.


I'm gonna fix it now. Just wait a second please :) Thanks for the rep, dude :)

ARE YOU SURE YOU ARE USING THE LATEST VERSION? In latest 1.2 I have this code:
if active=true {draw_text(x+3,y+2,string(draw_value)+string(cursor));} else {draw_text(x+3,y+2,draw_value);}

Edited by Saruwatari, 28 April 2011 - 03:17 PM.

  • 0

#7 whoisit

whoisit

    Always Learning

  • New Member
  • 242 posts
  • Version:GM8

Posted 29 April 2011 - 06:59 AM

ARE YOU SURE YOU ARE USING THE LATEST VERSION? In latest 1.2 I have this code:


100% sure ;)
  • 0

#8 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 29 April 2011 - 12:38 PM

ARE YOU SURE YOU ARE USING THE LATEST VERSION? In latest 1.2 I have this code:


100% sure ;)


Damn you got me, I'm trying to block chr(10) and also "
" thing but it's harder than it seems :P Well I'm going back to work, be sure to check out new version and thanks for testing it :)
  • 0

#9 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 01 May 2011 - 03:47 PM

Okay! New update is here! Updated to 1.3. Read changelog to get more information ;)
  • 0

#10 whoisit

whoisit

    Always Learning

  • New Member
  • 242 posts
  • Version:GM8

Posted 01 May 2011 - 07:36 PM

This is an excellent addition to GM.
Version 1.3 seems to be working 100% correctly.
  • 0

#11 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 01 May 2011 - 08:25 PM

Always great to hear that :)

Gonna add cursor moving, copying and pasting and some new things into 1.4. Will be hard to do all the stuff though. :P
  • 0

#12 07k3poja

07k3poja

    GMC Member

  • New Member
  • 2 posts

Posted 22 July 2011 - 08:59 PM

Awesome! It's highly effective and it is going to save me so much time! Note-you could add an extra argument to specify the height of the textbox, so different fonts and text sizes will fit in it (although I easily fixed this).
Can't wait for Version 1.4!
  • 0

#13 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 23 July 2011 - 09:56 AM

Well dude I'm sorry to tell you, but it doesn't look like I'll be developing any more versions. The version 1.4 just took literally dozens of lines of code and... I finish one part and the other just fails. Also I haven't got enough time to do it right now...

I hope I'll get to it before the end of the month.
Thanks for the positive reply, though :)

EDIT: 1.4 is currently in development!

Edited by Saruwatari, 12 August 2012 - 11:29 PM.

  • 0

#14 DEATHINCARNAT3

DEATHINCARNAT3

    GMC Member

  • GMC Member
  • 30 posts

Posted 15 February 2012 - 01:29 PM

Hey. I just applied this to my game and it works so well. Although I am struggling to integrate an ini save code for individual text boxes, for example: I have two boxes (One for my ip address and one for my Nickname) I want to make it so when I click my done button, which returns to the main menu, to save my nickname to my master.ini file. But all in all I am very impressed. I had been trying to make my own text boxes and kept getting so so close but never could get quite there, this solved all my problems. Thank you and i look forward to 1.4 hopefully. :thumbsup:
  • 0

#15 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 18 February 2012 - 03:38 PM

Hey. I just applied this to my game and it works so well. Although I am struggling to integrate an ini save code for individual text boxes, for example: I have two boxes (One for my ip address and one for my Nickname) I want to make it so when I click my done button, which returns to the main menu, to save my nickname to my master.ini file. But all in all I am very impressed. I had been trying to make my own text boxes and kept getting so so close but never could get quite there, this solved all my problems. Thank you and i look forward to 1.4 hopefully. :thumbsup:


Hey there, thanks for reply and for positive critics. It's not really that hard if you just keep trying. All my GML learning was based on method try-fail and so is this project. Maybe if you guys really like this, I may get back to 1.3 and start developping 1.4 all over again. I seem to have quite a lot of time now (9 days of holiday).

EDIT: Beginning today, August 12th, I've began developping the textboxes again and I'm planning to continue until final 1.4 version will come out. Leave feedback on what should be added please :)

Edited by Saruwatari, 11 August 2012 - 09:46 PM.

  • 0

#16 Sirosky

Sirosky

    GMC Member

  • GMC Member
  • 1323 posts
  • Version:GM8

Posted 11 August 2012 - 11:38 PM

Excellent work. Visually, it is impressive, and functionally, it is flawless. Haven't tested the implementation process as I don't have a game that needs it. But I like how it looks, I'm sure I'll find something that could use it. :biggrin: Btw, +1 rep for your excellent work.
  • 0

#17 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 12 August 2012 - 10:31 AM

Excellent work. Visually, it is impressive, and functionally, it is flawless. Haven't tested the implementation process as I don't have a game that needs it. But I like how it looks, I'm sure I'll find something that could use it. :biggrin: Btw, +1 rep for your excellent work.


Thank you. I'm currently spending long hours to create copy/paste/cut, cursor moving, mouse selecting etc. What I finished is in first post, in Changelog. Implementation is tested, works great, just export & import the scripts, and don't forget to call init script before creating any textboxes.

Currently deleting usage of "keyboard_string" due to its limitation to 1024 characters... Gosh this will take long to do :D DONE! Now let's start with the hardest part of all :/

Edited by Saruwatari, 12 August 2012 - 01:00 PM.

  • 0

#18 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 12 August 2012 - 11:32 PM

Bump... My hands are full of work, it's second day now and it has some of the features already done, but there's still a lot more I want in 1.4, to create as great textbox engine as never seen before in GM. But every single feature brings few bugs with it, so it takes time... Few more days and I will finish it I hope. Keep checking out the changelog in first post as well as this topic to get the new version right away.

Edited by Saruwatari, 12 August 2012 - 11:32 PM.

  • 0

#19 PrinceOthman

PrinceOthman

    GMC Member

  • GMC Member
  • 434 posts
  • Version:GM8

Posted 16 August 2012 - 09:19 AM

Features I think you should add:
- Moving the blinker with the left and right arrows
- Highlighting text with the mouse for copying, cutting, and pasting etc.
- Multi-line boxes

Good-job so far btw! :)
  • 0

#20 Saruwatari

Saruwatari

    GMC Member

  • GMC Member
  • 214 posts
  • Version:GM8

Posted 16 August 2012 - 06:26 PM

Features I think you should add:
- Moving the blinker with the left and right arrows
- Highlighting text with the mouse for copying, cutting, and pasting etc.
- Multi-line boxes

Good-job so far btw! :)



Please check the changelog and find 1.4 version... Those features are all already added, just wondering if I'll extend it to multi-line... The finished 1.4 should be upped here in 3-4 days.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users