-
May 29th, 2009, 02:10 PM
#1
Thread Starter
Hyperactive Member
Invisible Characters?
I'm making a program that changes a word then adds it to a listbox, the only problem is, when I change the word, I don't want the change to be noticeable, are their any invisible characters?
Sorry if my posts are misleading or sometimes rude, I'm just trying to get information so try to help me out.
-
May 29th, 2009, 02:12 PM
#2
Re: Invisible Characters?
There are characters that don't have a visual representation in text, but I really don't get what you are after here...
-
May 29th, 2009, 02:14 PM
#3
Re: Invisible Characters?
you want a display word + a corresponding hidden word?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 29th, 2009, 02:50 PM
#4
Thread Starter
Hyperactive Member
Re: Invisible Characters?
Originally Posted by kleinma
There are characters that don't have a visual representation in text, but I really don't get what you are after here...
If the word that is being changed is "Word" then when the word is changed with the invisible character, it will look like "Word" . Basically I don't want the word to have any visual change.
Sorry if my posts are misleading or sometimes rude, I'm just trying to get information so try to help me out.
-
May 29th, 2009, 03:01 PM
#5
Re: Invisible Characters?
again, I still don't get what you are after here. Not at all.
If you want to have some hidden value associated with a given string, then make a structure with 2 members, and override ToString to emit the actual string member you want for display purposes, while leaving the other one to be this edited version you want.
This is only a guess as to a solution, since I have no idea at all what it is you are actually trying to accomplish.
-
May 29th, 2009, 03:05 PM
#6
Thread Starter
Hyperactive Member
Re: Invisible Characters?
Originally Posted by kleinma
again, I still don't get what you are after here. Not at all.
If you want to have some hidden value associated with a given string, then make a structure with 2 members, and override ToString to emit the actual string member you want for display purposes, while leaving the other one to be this edited version you want.
This is only a guess as to a solution, since I have no idea at all what it is you are actually trying to accomplish.
There will be 2 list boxes, one with the word to be replaced, the other with what it will be replaced with, but the user will not see the words be replaced at all, when the user presses a button it will replace all of the words in the listbox with the corresponding index in the other listbox. So, if you put "Word" in listbox one and "Words" is placed in listbox 2, then when the user presses a button, it will change only the one instance of "Word" that they chose to "Words"
Does that make sense?
Sorry if my posts are misleading or sometimes rude, I'm just trying to get information so try to help me out.
-
May 29th, 2009, 03:10 PM
#7
Re: Invisible Characters?
not really to be honest.
It probably doesn't help that the string you picked to use is "word". just makes reading it more confusing.
So there are 2 listboxes, listbox1 has "HELLO" selected in it. listbox2 has "WORLD" selected in it. User clicks a button, and listbox2's text should change to be "HELLO", except it should not actually change in the UI, and continue to say "WORLD". Is that what you are asking for?
-
May 29th, 2009, 03:18 PM
#8
Thread Starter
Hyperactive Member
Re: Invisible Characters?
Originally Posted by kleinma
not really to be honest.
It probably doesn't help that the string you picked to use is "word". just makes reading it more confusing.
So there are 2 listboxes, listbox1 has "HELLO" selected in it. listbox2 has "WORLD" selected in it. User clicks a button, and listbox2's text should change to be "HELLO", except it should not actually change in the UI, and continue to say "WORLD". Is that what you are asking for?
I forgot to mention that the words being replaced would be in a textbox.
Example:
Code:
textbox1.replace(listbox1.item(1),listbox2.item(1))
See what I mean? I know how to do this, but if the contents of the text box are:
The word word in this sentence will be replaced with words.
So it would look like this:
The word words in this sentence will be replaced with words.
in the previous example, listbox1.item(1) was word, listbox2.item(1) was words
Sorry if my posts are misleading or sometimes rude, I'm just trying to get information so try to help me out.
-
May 29th, 2009, 03:20 PM
#9
Re: Invisible Characters?
Originally Posted by CoBHC
The word word in this sentence will be replaced with words.
and how is it supposed to decide if it should replace the blue "word" or the red "word" in that sentence?
-
May 29th, 2009, 03:26 PM
#10
Re: Invisible Characters?
He probably wants to use a listbox as a container and change something but this change should not be obvious.
-
May 29th, 2009, 03:28 PM
#11
Thread Starter
Hyperactive Member
Re: Invisible Characters?
Originally Posted by kleinma
and how is it supposed to decide if it should replace the blue "word" or the red "word" in that sentence?
That is why I need characters that aren't visible. So "word" when changed with the new characters length would be 5 instead of 4 but it would still look like "word"
Sorry if my posts are misleading or sometimes rude, I'm just trying to get information so try to help me out.
-
May 29th, 2009, 03:33 PM
#12
Addicted Member
Re: Invisible Characters?
I used a "hidden" character when I wrote some C64 software...
IIRC, ASCII character 255 looks like a space, but obviously is saved differently since it is not ASCII character 32 (the spacebar space).
So, you could append Chr(255) to the end of each word, or if users are suspicious of words that have "a space" after them, have every word before the change to *really* have Chr(32) after it. Then, change the last character of that word to Chr(255).
Last edited by JugglingReferee; May 29th, 2009 at 03:39 PM.
PC #1: Athlon64 X2+Vista64+VS2008EE+.NET3.5 #2: XP (all flavours Ghost'd)+VS2008EE+.NET3.5
Help Files: HelpMaker · Dr. Explain · Create Icons: IcoFX
"Whoever eats my flesh and drinks my blood has eternal life, and I will raise him on the last day." John 6:54
-
May 29th, 2009, 03:35 PM
#13
Addicted Member
Re: Invisible Characters?
Or, could you use the tag property to determine if a word has been changed?
For the ListBox control with 8 entries, the tag property will be 8 characters long. The nth character is a 0 if unaltered, and 1 if altered.
PC #1: Athlon64 X2+Vista64+VS2008EE+.NET3.5 #2: XP (all flavours Ghost'd)+VS2008EE+.NET3.5
Help Files: HelpMaker · Dr. Explain · Create Icons: IcoFX
"Whoever eats my flesh and drinks my blood has eternal life, and I will raise him on the last day." John 6:54
-
May 29th, 2009, 03:37 PM
#14
Re: Invisible Characters?
Originally Posted by JugglingReferee
I used a "hidden" character when I wrote some C64 software...
IIRC, ASCII character 255 looks like a space, but obviously is saved differently since it is not ASCII character 32 (the spacebar space).
So, you could append ASC(255) to the end of each word, or if users are suspicious of words that have "a space" after them, have every word before the change to *really* have ASC(32) after it. Then, change the last character of that word to ASC(255).
ASC returns an integer based on a passed in char. I think you probably mean Chr() to get a character from its numeric ASCII value.
Either way, I don't think this will work. Usually these characters will just show up as square blocks in the UI.
-
May 29th, 2009, 03:38 PM
#15
Addicted Member
Re: Invisible Characters?
Of course you are correct, kleinma. I meant to say Chr().
I will edit the post.
PC #1: Athlon64 X2+Vista64+VS2008EE+.NET3.5 #2: XP (all flavours Ghost'd)+VS2008EE+.NET3.5
Help Files: HelpMaker · Dr. Explain · Create Icons: IcoFX
"Whoever eats my flesh and drinks my blood has eternal life, and I will raise him on the last day." John 6:54
-
May 29th, 2009, 03:40 PM
#16
Re: Invisible Characters?
or just use a custom listItem:
vb Code:
Public Class listItem
Public displayString As String
Public hiddenString As String
Public Sub New(ByVal _displayString As String, ByVal _hiddenString As String)
displayString = _displayString
hiddenString = _hiddenString
End Sub
Public Overrides Function ToString() As String
Return displayString
End Function
End Class
vb Code:
ListBox1.Items.Add(New listItem("this is the display string", "this is the hidden string"))
to retrieve the hidden string:
vb Code:
MsgBox(DirectCast(ListBox1.SelectedItem, listItem).hiddenString)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 29th, 2009, 03:44 PM
#17
Re: Invisible Characters?
Originally Posted by .paul.
or just use a custom listItem:
vb Code:
Public Class listItem
Public displayString As String
Public hiddenString As String
Public Sub New(ByVal _displayString As String, ByVal _hiddenString As String)
displayString = _displayString
hiddenString = _hiddenString
End Sub
Public Overrides Function ToString() As String
Return displayString
End Function
End Class
vb Code:
ListBox1.Items.Add(New listItem("this is the display string", "this is the hidden string"))
to retrieve the hidden string:
vb Code:
MsgBox(DirectCast(ListBox1.SelectedItem, listItem).hiddenString)
That was my original suggestion, but the more he described the app, the more confusing it sounded, and the less viable that seemed to be a solution.
-
May 29th, 2009, 03:44 PM
#18
Thread Starter
Hyperactive Member
Re: Invisible Characters?
Originally Posted by JugglingReferee
Or, could you use the tag property to determine if a word has been changed?
For the ListBox control with 8 entries, the tag property will be 8 characters long. The nth character is a 0 if unaltered, and 1 if altered.
I'm not replacing the items in the listbox. I'm replacing the text in the textbox with items from the listbox.
Sorry if my posts are misleading or sometimes rude, I'm just trying to get information so try to help me out.
-
May 29th, 2009, 03:48 PM
#19
Re: Invisible Characters?
Originally Posted by kleinma
That was my original suggestion, but the more he described the app, the more confusing it sounded, and the less viable that seemed to be a solution.
thats what i was thinking of in post #3 + IMO its still the most sensible solution
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 29th, 2009, 03:50 PM
#20
Re: Invisible Characters?
You may be right, but I am still unsure of the exact intent here to be honest.
-
May 29th, 2009, 04:03 PM
#21
Thread Starter
Hyperactive Member
Re: Invisible Characters?
Originally Posted by kleinma
You may be right, but I am still unsure of the exact intent here to be honest.
if * was an invisble character, and I added it to "word" word would still look like this"word" and if it was not an invisible character, word would look like this "word*" I don't want it to add extra spaces either, I want the textboxes contents to look exactly the same when a word is added to the listbox, and changed.
Sorry if my posts are misleading or sometimes rude, I'm just trying to get information so try to help me out.
-
May 29th, 2009, 04:06 PM
#22
Re: Invisible Characters?
You can't. So you need to come up with a different approach. Like caching the string that is "real" in a variable and always displaying the original string you WANT the user to see. There isn't a way to "fake" the computer out in thinking a string is x length when it is really y length. It just doesn't work that way, and it doesn't need to. You just need to implement things differently.
-
May 29th, 2009, 04:10 PM
#23
Thread Starter
Hyperactive Member
Re: Invisible Characters?
Originally Posted by kleinma
You can't. So you need to come up with a different approach. Like caching the string that is "real" in a variable and always displaying the original string you WANT the user to see. There isn't a way to "fake" the computer out in thinking a string is x length when it is really y length. It just doesn't work that way, and it doesn't need to. You just need to implement things differently.
I'm not trying to make the computer think it's a different length, I'm trying to get the computer to not see a character.
Sorry if my posts are misleading or sometimes rude, I'm just trying to get information so try to help me out.
-
May 29th, 2009, 04:14 PM
#24
Re: Invisible Characters?
Keep a class-level variable called RealString, and use it when you want to access the data. Update it when the contents of the TextBox change. When you want to access the length or the data, use it.
-
May 29th, 2009, 05:25 PM
#25
Re: Invisible Characters?
Perhaps telling us what the point in doing this is would help us to help you.
Give us an example of what you want your program to do.
If you don't want characters to come up then just declare an extra variable to hold the word you want hidden and store the word you want to show up in the textbox.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|