The following code (see end of message) moves an Editfield (DocField) text
cursor to the beginning of the current line if the Command-Left keys (Mac)
or Control-Left keys (Win32) are pressed.  Command-Right keys (Mac) and
Control-Right keys (Win32) move the text cursor to the end of the current
line (by finding the first char of the next line and then stepping back one
char to end of current line).

If I place the following code in the window's KeyDown event, on Mac OS X the
Mac target works 100% properly, but on Win32 the Win32 target keys do not
fire.

If I place the same code in the Editfield's KeyDown event, on Mac OS X the
Mac target works differently by NOT moving the text cursor to the right
places, and on Win32 the Win32 target keys do not fire.

If I place the same code in the window's EnableMenuItems event, both Mac and
Win32 keys fire appropriately, but the text cursor is NOT moved to the right
place.

Does anyone know why I'm not seeing consistent results with each scenario
and how I can best resolve the problem???  Help...  :-)

RB2006r1, Mac OS X 10.4.7

Regards,
Dave Wooldridge
RB Garage - http://www.RBGarage.com

----------------------------------------

Dim curlinenum, curcharpos As Integer
  
#If TargetWin32 then

If Keyboard.AsyncKeyDown(123) AND Keyboard.AsyncControlKey then
    //Control-Left Arrow
    curlinenum = DocField.LineNumAtCharPos(DocField.SelStart)
    curcharpos = DocField.CharPosAtLineNum(curlinenum)
    DocField.SelStart = curcharpos
      
Elseif Keyboard.AsyncKeyDown(124) AND Keyboard.AsyncControlKey then
    //Control-Right Arrow
    curlinenum = DocField.LineNumAtCharPos(DocField.SelStart)
    //Next line.
    curcharpos = DocField.CharPosAtLineNum(curlinenum+1)
    //minus 1 = last char of previous line.
    DocField.SelStart = curcharpos-1
      
End If
    
#Else //Mac
    
If Keyboard.AsyncKeyDown(123) AND Keyboard.AsyncOSKey then
    //Cmd-Left Arrow
    curlinenum = DocField.LineNumAtCharPos(DocField.SelStart)
    curcharpos = DocField.CharPosAtLineNum(curlinenum)
    DocField.SelStart = curcharpos
      
Elseif Keyboard.AsyncKeyDown(124) AND Keyboard.AsyncOSKey then
    //Cmd-Right Arrow
    curlinenum = DocField.LineNumAtCharPos(DocField.SelStart)
    //Next line.
    curcharpos = DocField.CharPosAtLineNum(curlinenum+1)
    //minus 1 = last char of previous line.
    DocField.SelStart = curcharpos-1
      
End If
    
#Endif

----------------------------------------



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to