Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 7:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Arrays Again
PostPosted: October 23rd, 2009, 10:34 am 
Offline

Joined: January 23rd, 2006, 2:57 pm
Posts: 55
Location: Belfast
Opus: 9.5
OS: Win 7
System: i7 8G ram
Can anyone please check the attached pub.

If I type X in the input box and press button In. X is displayed in TextTest and TextTest2. If you add more letters they will be displayed in the text boxes separated by line and comma they will also be sorted. Now input one of the letters already entered in the text boxes and press Out, this letter will disapear. This is all fine. BUT if you input another letter you get a space at the top of TextTest. So...
How do I stop this space appearing.
Also I could not get TextTest(line spacing) to split to xArray and had to use TextTest2(comma spacing) so Im duplicating the process??? I only need TextTest to work, would like to delete TextTest2.

Have spent days trying to solve this on my own - but there comes a time etc etc etc.

Still getting to grips with scripting so any help would be great

Cheers
Paul


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
 Post subject:
PostPosted: October 23rd, 2009, 11:02 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Paul,

Don't post EXE files. Anybody without a sandbox, would be daft to run an unknown program and more importantly, without access to the source code, it's like shooting in the dark trying to work out what is going on.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: October 23rd, 2009, 12:24 pm 
Offline

Joined: January 23rd, 2006, 2:57 pm
Posts: 55
Location: Belfast
Opus: 9.5
OS: Win 7
System: i7 8G ram
Sorry folks wasnt thinking
Here you go...


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
 Post subject:
PostPosted: October 23rd, 2009, 9:04 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
You're over complicating the program.

The 'in' bit is okey, except that you've modified the way the \n escape char is used from the example I posted last time - this will have a negative effect off an extra last line. See the recent posting for Clive.

The 'out' bit simply isn't necessary. The data should be manipulate from an array behind the scene. Just use the same looping procedure as 'in' but if a match is found exclude this from the array copy.

Use the get / set selection function to just convert the array into the text using the join function.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: October 29th, 2009, 10:24 am 
Offline

Joined: January 23rd, 2006, 2:57 pm
Posts: 55
Location: Belfast
Opus: 9.5
OS: Win 7
System: i7 8G ram
Hi Mack
Thx for the reply. I need the out bit. Let me see if I can explain myself better/simpler....

I want people to log into a room as they enter ie typing their name(varName) and clicking on 'In'. So they they show up in a textbox(TextTest)

TextTest.SetSelection(0,-1)
xArray[xArray.length] = varName
xArray.sort()
TextTest.ReplaceSelection(xArray.join("\n"));
TextTest.SetSelection(-1)

This works fine.

If someone leaves the room they log out following the same procedure except they hit the 'Out' button and their name deletes from the texbox(TextTest).

var Char1=varName.length+1;
var Char=TextTest.FindText(varName,0);
var Char2=Char+Char1;
TextTest.SetSelection(Char,Char2);
TextTest.ReplaceSelection("");

This works fine.

Problem is when the next person loggs in the last person to log out is also logged back in again.

Any thoughts.
Cheers
Paul


Top
 Profile  
 
 Post subject:
PostPosted: October 29th, 2009, 11:09 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Paul,

What I meant was that your method for the OUT bit was not necessary - it's like pruning your roses with a chainsaw.

The data IN is managed by a simple array. In the previous examples, this array is used to find duplicates but the same idea of looping through the array looking for a value and NOT transferring it to array used for the text replacement is a simple method of achieving your requirement.

At the moment, you're not updating the IN array in the OUT process but hacking the data out of the string.

Ockham's razor.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: October 29th, 2009, 1:14 pm 
Offline

Joined: January 23rd, 2006, 2:57 pm
Posts: 55
Location: Belfast
Opus: 9.5
OS: Win 7
System: i7 8G ram
AAAAHH Haaaaaaaaa!

Light came on and the penny droped. Got it now, although it took a while with much grinding of neurons and a large slice of help from yourself.

Cheers Mack have just moved up another rung on the ladder of script.

Paul


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 50 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group