View Full Version : Working on calculator script - help please
StefanStavrev 08-13-2006, 02:34 PM Hey guys
I have a Backspace button, and i want when i click it one space to be deleted in the textField...
I downloaded some scripts but they don't have backspace button...
Someone has any ideas how to do that?
|
|
NateH
08-13-2006, 11:20 PM
window;
rowColumnLayout -nc 2;
textField -text "Im a string of text" nphText;
button -l "Backspace" -c "nphBackspace";
showWindow;
proc nphBackspace()
{
string $text = `textField -q -text nphText`;
textField -e -text (startString($text, (size($text)-1))) nphText;
}
here you are.
Explanation:
grabs text from field, takes it size - 1 and uses that for startString command.
startString is really usefull, it just takes the string and outputs from the start through the number of chars you told it.
then i just set that text back into the text field.
Let me know if that isnt a broken down anough section of code, I can certainly expand that out for you.
StefanStavrev
08-14-2006, 01:35 AM
I had no idea about this function startString :) Wonderfull
Thanks for the info
PS : I solved this problem today using the subString function...
Take care Bro :)
CGTalk Moderation
08-14-2006, 01:35 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.