Topic The tutorial for beginners

We have two new locations for Keyman technical support:

The Tavultesoft Forums are now read only.


# The tutorial for beginners   2016-02-03 23:08:05.090
br Julian Griffin OSL
Hello I am new to Keyman Desktop & Keyman Developer.

   I have been working my way through the tutorial. By step 6 we have the following code which works well and I think I understand it.
:
c Simplified French Keyboard for Keyman 9.0
c
c This keyboard program uses a simplified set of keys
c for typing French, especially for those who don't know the
c standard French keyboard.
c
c NOTE: This keyboard was created from the Keyman keyboard
c programming tutorial.

store(&Version) "9.0"             c This keyboard is for use with Keyman 9.0
store(&Name)    "Quick French"
store(&BITMAP) 'qfrench.ico'
store(&MnemonicLayout) "1"        c This keyboard uses a mnemonic layout.

begin Unicode > use(Main)
group(Main) using keys

store( plainvowels )  'a'    'e'    'i'    'o'    'u'      'A'    'E'    'I'    'O'    'U'
store( acutevowels )  U+00E1 U+00E9 U+00ED U+00F3 U+00FA   U+00C1 U+00C9 U+00CD U+00D3 U+00DA
store( gravevowels )  U+00E0 U+00E8 U+00EC U+00F2 U+00F9   U+00C0 U+00C8 U+00CC U+00D2 U+00D9
store( circumvowels ) U+00E2 U+00EA U+00EE U+00F4 U+00FB   U+00C2 U+00CA U+00CE U+00D4 U+00DB
store( dresisvowels ) U+00E4 U+00EB U+00EF U+00F6 U+00FC   U+00C4 U+00CB U+00CF U+00D6 U+00DC

"'" + any( plainvowels ) > index( acutevowels, 2 )
"`" + any( plainvowels ) > index( gravevowels, 2 )
"^" + any( plainvowels ) > index( circumvowels, 2 )
'"' + any( plainvowels ) > index( dresisvowels, 2 )

"'" + "y" > U+00FD    c Acute-accented Y
"'" + "Y" > U+00DD

"'" + "c" > U+00E7    c C-cedilla
"'" + "C" > U+00C7

"" + ">" > U+00BB

   In step 7 an undesirable behaviour is noted; if one wishes to get a single quote "'", one has to press the single quote "'" key twice. Step 8 introduces 'Deadkey' to change it to a single press gives a quote and two presses to get an accented character. And step 9 lists complete come.
:
c Simplified French Keyboard for Keyman 9.0
c
c This keyboard program uses a simplified set of keys
c for typing French, especially for those who don't know the
c standard French keyboard.
c
c NOTE: This keyboard was created from the Keyman keyboard
c programming tutorial.

store(&Version) "9.0"             c This keyboard is for use with Keyman 9.0
store(&Name)    "Quick French"
store(&Bitmap)  "qfrench.ico"
store(&MnemonicLayout) "1"        c This keyboard uses a mnemonic layout.

begin Unicode > use(Main)

group( Main ) using keys

c Store the upper and lowercase vowels with different accents
store( plainvowels )  'a'    'e'    'i'    'o'    'u'      'A'    'E'    'I'    'O'    'U'
store( acutevowels )  U+00E1 U+00E9 U+00ED U+00F3 U+00FA   U+00C1 U+00C9 U+00CD U+00D3 U+00DA
store( gravevowels )  U+00E0 U+00E8 U+00EC U+00F2 U+00F9   U+00C0 U+00C8 U+00CC U+00D2 U+00D9
store( circumvowels ) U+00E2 U+00EA U+00EE U+00F4 U+00FB   U+00C2 U+00CA U+00CE U+00D4 U+00DB
store( dresisvowels ) U+00E4 U+00EB U+00EF U+00F6 U+00FC   U+00C4 U+00CB U+00CF U+00D6 U+00DC

c Output deadkeys only for the accent keys pressed
+ "'" > dk(quote)     c Quote for acute accent
+ "`" > dk(bkquote)   c Backquote for grave accent
+ "^" > dk(caret)     c Caret for circumflex
+ '"' > dk(dbquote)   c Double-quote for dieresis

c Rules for accented vowels
dk(quote)   + any( plainvowels ) > index( acutevowels, 2 )
dk(bkquote) + any( plainvowels ) > index( gravevowels, 2 )
dk(caret)   + any( plainvowels ) > index( circumvowels, 2 )
dk(dbquote) + any( plainvowels ) > index( dresisvowels, 2 )

c Rules for other characters
dk(quote) + "y" > U+00FD  c Acute-accented Y
dk(quote) + "Y" > U+00DD

dk(quote) + "c" > U+00E7  c C-cedilla
dk(quote) + "C" > U+00C7

"" + ">" > U+00BB

c Rules for the accent character itself (type it twice)
dk(quote)   + "'" > "'"   c Quote
dk(bkquote) + "`" > "`"   c Backquote
dk(caret)   + "^" > "^"   c Caret
dk(dbquote) + '"' > '"'   c Double-quote

c End of keyboard

   My difficulty is that both scripts do exactly the same thing.
In both scripts, a single press on the single quote key "'" followed by a vowel produces an á, é, í, ó, ú.
And in both scripts, a double press of the single quote key "'" produces a single quote character "'".

Please advise, have I misunderstood, or does Keyman Developer need different code?

Thank you.
Julian Griffin
# RE: The tutorial for beginners   2016-02-05 07:25:18.850
Marc Durdin
Tavultesoft Staff
No, you have it right. The final step is just listing the complete code for the tutorial as a reference.
# RE: The tutorial for beginners   2016-02-06 00:59:55.070
br Julian Griffin OSL
Thank you, I understand the reason for the two listings. It is just that in Step 7 an error is identified:
:
Step 7
For example, look at what happens if you type the following quote:
:
'Alors Alice demanda, "O est ma chatte?"'
As you can see, it comes out incorrectly as:
:
Álors Alice demanda, Ö est ma chatte?"'

The problem occurs when we have a word in quotes that begins with a vowel: the keyboard will convert it to an accented vowel. We will need to come up with a solution to this problem.

Step 8 purports to fix this error.
:
Step 8
:
We need to distinguish between the output of this rule, when the user wants a quote, and that of a single quote press, when the user wants to place an accent on a vowel.
To implement this behaviour, we use deadkeys.
If you test the keyboard now, you will find that the error no longer occurs. This is because accented vowels are only produced after the deadkey, and no deadkey is output if the user types a quote key twice.

However, both scripts output the same thing. The error identified in Step 7 is not fixed in Step 8. So the listing in Step 9 still has the same error as identified in Step 7. ie 'A gives Á But Step 8 says that the listing in Step 9 should behave as: 'A gives 'A and ''A gives Á. But both scripts behave the same way, the wrong way, identified in Step 7, is not fixed by the use of the Deadkey statements in Steps 8 & 9.
:
Or have I misunderstood the text?
I feel I must say that the sentence highlighted above, I found the text a little confusing with all the sub-clauses separated with commas ','.

I am asking this question because before I can use the 'Deadkey' statement in my own code, I need to see a working syntax that I can explore.

Thank you for your help and guidance.
Regards
Julian Griffin
# RE: The tutorial for beginners   2016-02-06 08:11:21.757
Marc Durdin
Tavultesoft Staff
The intent of those rules is that if the user presses the quote key twice, they will get a quote character. If they press the quote key once, then type a vowel, they will get the accented vowel character, that is:

''A gives 'A

'A gives Á

Is that what you are seeing?
# RE: The tutorial for beginners   2016-02-06 09:45:06.143
br Julian Griffin OSL
Thank you Marc, it seems I had the wrong end of the stick. You are right; your examples are what I get. I am unclear as to how I got it so wrong; I'm going to put it down to inexperience with Keyman. Anyway, thank you for your help and patience. I can now explore Deadkeys, which are still a bit of a mystery to me. But the older I get the less I know or am sure of. Thank you.

Regards
Julian Griffin