Complete control of field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Complete control of field
Hi
In a project I´m working on I want to make a field where I have complete control over the user input - both wich character is allowed and how many lines and how wide the field is. full control over delete, backspace etc. The reason is that I need to make the field contain a constant amount of characters with a constant amount of linefeeds. Think of it like a grid of characters with monospaced characters...:
.........
.........
.........
.........
The grid must never change. Thats why I have to hardcode e.g. backspace with rawkeydown so it does not change the layout of the text.
I have come some way but I am now in need of knowledge.
I am not sure when to use keydown and rawkeydown.
Does Livecode have a priority to the execution of these two messages?
I have tried to use rawkeydown but it gave me problems when I want to allow foreign characters.
I guess what I am asking is: when should I use keydown and when should I use rawkeydown and does these two messages affect eachother?
Sjat
In a project I´m working on I want to make a field where I have complete control over the user input - both wich character is allowed and how many lines and how wide the field is. full control over delete, backspace etc. The reason is that I need to make the field contain a constant amount of characters with a constant amount of linefeeds. Think of it like a grid of characters with monospaced characters...:
.........
.........
.........
.........
The grid must never change. Thats why I have to hardcode e.g. backspace with rawkeydown so it does not change the layout of the text.
I have come some way but I am now in need of knowledge.
I am not sure when to use keydown and rawkeydown.
Does Livecode have a priority to the execution of these two messages?
I have tried to use rawkeydown but it gave me problems when I want to allow foreign characters.
I guess what I am asking is: when should I use keydown and when should I use rawkeydown and does these two messages affect eachother?
Sjat
Re: Complete control of field
You probably want to use "rawKeyDown".
I find them to be mainly interchangable, in that what you can do with one you can usually do with the other. RawKeyDown will respond more universally, especially with backspace and delete, and with the extra keys you find on full keyboards. The feedback you get from rawKeyDown is sort of encoded, as opposed to clear text with "keyDown", but you can handle that by prepping your handlers.
Remember to pass "rawKeyDown" or nobody will know anything happened.
Craig Newman
I find them to be mainly interchangable, in that what you can do with one you can usually do with the other. RawKeyDown will respond more universally, especially with backspace and delete, and with the extra keys you find on full keyboards. The feedback you get from rawKeyDown is sort of encoded, as opposed to clear text with "keyDown", but you can handle that by prepping your handlers.
Remember to pass "rawKeyDown" or nobody will know anything happened.
Craig Newman
Re: Complete control of field
Thanks
I wanted to stick to rawkey but then realized that rawkey didn't capture foreign characters only the keyboard code. The rawkey will return the code for the character of the international keyboard. That's why i wanted to know if there is a priority in the exexution of them - since it seems I have to use both rawkeydown and keydown.
Sjat
I wanted to stick to rawkey but then realized that rawkey didn't capture foreign characters only the keyboard code. The rawkey will return the code for the character of the international keyboard. That's why i wanted to know if there is a priority in the exexution of them - since it seems I have to use both rawkeydown and keydown.
Sjat
Re: Complete control of field
Hi Sjat,
could you give a little of a use case? To cover every possible input from the user is a tricky thing as you already noticed.
Is your matrix prefilled with e.g. spaces? is the user supposed to type freely and create the matrix and you want to control the format?
It would help to have a better understanding of what you are after since I don't quite see where you are heading.
If you have certain restrictions on the input aside from the number of rows and columns it would help to narrow down the code.
Kind regards
Bernd
could you give a little of a use case? To cover every possible input from the user is a tricky thing as you already noticed.
Is your matrix prefilled with e.g. spaces? is the user supposed to type freely and create the matrix and you want to control the format?
It would help to have a better understanding of what you are after since I don't quite see where you are heading.
If you have certain restrictions on the input aside from the number of rows and columns it would help to narrow down the code.
Kind regards
Bernd
Re: Complete control of field
Hi bernd
The field I´m creating is for a game. Let´s compare it to a scrabble board. The number of characters down and across is constant. And the allignement and the space between the characters is constant.
I could have used a bitmapped font and made sprites but I want to use livecodes exellent chunk and search functions. I can manage this by using a monospaced font.
I want the user to be able to click anywhere on the "board" - on any "tile" and type a word. But the word typed will overwrite any other thing that is alreade written in that location. Instead of the automatic behaviour in field wich is to insert the text and push the text that is already there to the the right. Same with backspace. Instead of deleting the character and shift the text already there one space to the left wich is the automatic behaviour in a field. (I know there are better terms for this...but I dont know them right now
)
I will put a space instead of shifting text left or right. in this way there is always so many characters down and so many characters across - like a scrabble board.
So on a blank board all the text will be filled with a space.
since I have started this thread I have done some more reading (Posting a question on the forum is always a good way to understanding your own problem. he he.)
Since the "keydown" message seems to lock the input in the same way as "rawkeydown" I think maybe I will use keydown in combination with the "shiftkey","backspacekey" and the other messages....
this should do the trick...
agree?
The field I´m creating is for a game. Let´s compare it to a scrabble board. The number of characters down and across is constant. And the allignement and the space between the characters is constant.
I could have used a bitmapped font and made sprites but I want to use livecodes exellent chunk and search functions. I can manage this by using a monospaced font.
I want the user to be able to click anywhere on the "board" - on any "tile" and type a word. But the word typed will overwrite any other thing that is alreade written in that location. Instead of the automatic behaviour in field wich is to insert the text and push the text that is already there to the the right. Same with backspace. Instead of deleting the character and shift the text already there one space to the left wich is the automatic behaviour in a field. (I know there are better terms for this...but I dont know them right now

I will put a space instead of shifting text left or right. in this way there is always so many characters down and so many characters across - like a scrabble board.
So on a blank board all the text will be filled with a space.
since I have started this thread I have done some more reading (Posting a question on the forum is always a good way to understanding your own problem. he he.)
Since the "keydown" message seems to lock the input in the same way as "rawkeydown" I think maybe I will use keydown in combination with the "shiftkey","backspacekey" and the other messages....
this should do the trick...
agree?
Re: Complete control of field
How often do you play scrabble? Do you do it onLine?
You will be able to control the integrity of your board. It is just a matter of keeping track of the character count and location in each line. As Bernd says, tedious, but straighforward.
Is it not possible to use an array of tiny fields, tiles, as you say, arranged in what looks like a board? I am not sure if this is better or not, since I have not seen your actual layout. Just a thought. At least there you do not need to watch the field layout, you just need to watch multi field focus as text is edited. Lots of "select the text of fld "fieldNumberPlusOne" and the like, every time you type a character into any particular field.
Craig Newman
You will be able to control the integrity of your board. It is just a matter of keeping track of the character count and location in each line. As Bernd says, tedious, but straighforward.
Is it not possible to use an array of tiny fields, tiles, as you say, arranged in what looks like a board? I am not sure if this is better or not, since I have not seen your actual layout. Just a thought. At least there you do not need to watch the field layout, you just need to watch multi field focus as text is edited. Lots of "select the text of fld "fieldNumberPlusOne" and the like, every time you type a character into any particular field.
Craig Newman
Re: Complete control of field
Hi Dunbarx
I used scrabble just as an example. I am not asking anyone to help me make scrabble. the game is quite different....
but anyway...as I posted above...I want to use the chunk and search functions and I think I have landed on using "keydown" for my purpose...
thanks for the help
sjat
BTW: I´m still wondering about the priority of "rawkeydown" and "keydown". Does the use of one nullify the other?
I used scrabble just as an example. I am not asking anyone to help me make scrabble. the game is quite different....
but anyway...as I posted above...I want to use the chunk and search functions and I think I have landed on using "keydown" for my purpose...
thanks for the help
sjat
BTW: I´m still wondering about the priority of "rawkeydown" and "keydown". Does the use of one nullify the other?
Re: Complete control of field
Hi Sjat,
here is my take on what you were describing.
I don't even know if I understood you correctly but have a look, maybe some parts of the code are useful.
Kind regards
Bernd
here is my take on what you were describing.
I don't even know if I understood you correctly but have a look, maybe some parts of the code are useful.
Kind regards
Bernd
Re: Complete control of field
Bernd
That´s exactly what i`m looking for. Great help.
Thank you very much.
Sjat
That´s exactly what i`m looking for. Great help.
Thank you very much.
Sjat
Re: Complete control of field
Hi Sjat,
glad I guessed right
Kind regards
Bernd
glad I guessed right

Kind regards
Bernd
Re: Complete control of field
Hi,
I loaded your little stack into the IOS tester and it worked there as well but I would like to use an IOS multiline field. I am not sure where to place the script though. Any ideas?
Dave
I loaded your little stack into the IOS tester and it worked there as well but I would like to use an IOS multiline field. I am not sure where to place the script though. Any ideas?
Dave
Re: Complete control of field
Hi Dave,
What exactly are you trying to do with this "funny" field in iOS? It is against all UI guidelines and except for special applications not well suited.
could you give me your use-case for the iOS multiline field versus the Livecode field?
I did not try to replicate the behavior of the "little stack" in iOS but reading the documentation for the Multi-line Input control it seems to be quite some coding and I am not shure you get the same amount of control over the field with it.
Maybe the Livecode field may be sufficient if "decorated" properly? I guess it all depends on what you want to do with it.
Kind regards
Bernd
What exactly are you trying to do with this "funny" field in iOS? It is against all UI guidelines and except for special applications not well suited.
could you give me your use-case for the iOS multiline field versus the Livecode field?
I did not try to replicate the behavior of the "little stack" in iOS but reading the documentation for the Multi-line Input control it seems to be quite some coding and I am not shure you get the same amount of control over the field with it.
Maybe the Livecode field may be sufficient if "decorated" properly? I guess it all depends on what you want to do with it.
Kind regards
Bernd
Re: Complete control of field
Hi Bn,
Actually this is closer to the stack I want to replicate in IOS. See attached stack. It says RawKey down is supported in IOS in the dictionary yet 60 lookers and no response to my post in 3 days.
http://forums.runrev.com/viewtopic.php?f=49&t=11342
I want to query a database and select a few hundred street names and place them in a global variable. As the user types in the first few letters of the street name I want to filter the variable and auto populate a list field next to it with street name choices from global variable. This is for emergency responders in a fire truck bouncing down the road. Typing in those type of situations is a pain. Why type 15 letters when I can type 3 and then click a line in the list and open the map page on the screen?
Can you explain why this would be against the Guidelines? Thanks.
Dave
Actually this is closer to the stack I want to replicate in IOS. See attached stack. It says RawKey down is supported in IOS in the dictionary yet 60 lookers and no response to my post in 3 days.
http://forums.runrev.com/viewtopic.php?f=49&t=11342
I want to query a database and select a few hundred street names and place them in a global variable. As the user types in the first few letters of the street name I want to filter the variable and auto populate a list field next to it with street name choices from global variable. This is for emergency responders in a fire truck bouncing down the road. Typing in those type of situations is a pain. Why type 15 letters when I can type 3 and then click a line in the list and open the map page on the screen?
Can you explain why this would be against the Guidelines? Thanks.
Dave
Re: Complete control of field
Hi Dave,
the field is against the UI guidelines since it has a fixed number of characters per line, only six lines and asterixes that fill the line regardless of the user input.
Now that I understand what you want I have set up a search field with a native iOS input field and posted it to your original thread:
http://forums.runrev.com/viewtopic.php? ... 409#p53409
Kind regards
Bernd
the field is against the UI guidelines since it has a fixed number of characters per line, only six lines and asterixes that fill the line regardless of the user input.
Now that I understand what you want I have set up a search field with a native iOS input field and posted it to your original thread:
http://forums.runrev.com/viewtopic.php? ... 409#p53409
Kind regards
Bernd