Page 2 of 2
Re: Odd Behaviour
Posted: Fri Apr 12, 2013 7:56 am
by BobFBurns
Hi CalScot
Thank you and everyone else who has replied. I am converting an amateur radio logbook program from DOS to Windows. The original application of around 10,000 lines with "Lotus 123" like menus compiles in Harbour and runs under Windows but lacks a proper GUI and printing facilities. Having said that, when I use the program in a radio competition which also requires me to use the radio equipment and a morse key or microphone at the same time the GUI would be too time consuming and full control from the keyboard is much faster - if I can find or program the required controls. This is my current challenge!
I noticed that PageDown is missing from the On Key control list but is present in the Clipper 5.3 list.
Regards
Bob (UK callsign G3OOU, website
www.g3oou.co.uk)
Re: Odd Behaviour
Posted: Fri Apr 12, 2013 9:26 am
by CalScot
Bob,
Interesting!
Although there's no OnKey for PgDn, I believe that you could use PgDn to invoke an associated procedure, such as to SetFocus on the "Save" or "Next" button, or however you've defined it, the nett effect of which would be to allow you to emulate the DOS_based Clipper input screen.
You could similarly assign procedures to UpArrow and DnArrow to set focus on the prior or subsequent TabStop.
For more on this, see the HMG-Help at:
"CA-Clipper 5.3"
"Guide To CA-Clipper"
"Commands"
Then scroll down to
"SET KEY Assign a procedure invocation to a key"
which, when clicked, displays the page on:
"SET KEY <nInkeyCode> TO [<idProcedure>]"
PgDn is Chr(3) and the InKey() code is K_PGDN. Make sure to " #Include 'inkey.ch' " if you use "K_PGDN" (advised!) rather than the ASCII Value.
I haven't tested it, but see no reason why it wouldn't work. (Famous last words, right?)
Good luck!
CalScot
Re: Odd Behaviour
Posted: Fri Apr 12, 2013 11:36 am
by esgici
BobFBurns wrote:
I noticed that PageDown is missing from the On Key control list ...
Code: Select all
#include <hmg.ch>
PROCEDURE Main()
DEFINE WINDOW frmMain at 0, 0 WIDTH 400 HEIGHT 300 MAIN
ON KEY ESCAPE ACTION ThisWindow.Release
ON KEY PRIOR ACTION MsgBox( "Page Up" )
ON KEY NEXT ACTION MsgBox( "Page Down" )
END WINDOW // frmMain
CENTER WINDOW frmMain
ACTIVATE WINDOW frmMain
RETURN // Main()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
Happy HMG'ing
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Re: Odd Behaviour
Posted: Fri Apr 12, 2013 12:40 pm
by BobFBurns
Hi All
Thanks for the suggestions. The initial problem is resolved. As advised in the previous post I also discovered that PgDn is known as NEXT and PgUp as PREVIOUS. The following code is one way to emulate the navigation process in Clipper. No doubt there are more elegant ways to code it but this does work.
Regards
Bob
#include "hmg.ch"
Function Main
set navigation extended /* Allow Return to move to next text box */
FldPtr := 1 /* Field number */
FldMax := 4 /* Maximum number of text boxes */
DEFINE WINDOW Win_1 ;
AT 0, 0;
WIDTH 600 ;
HEIGHT 300 ;
TITLE 'HMG Test';
MAIN
on key UP of Win_1 action kytest(1) /* cursor up */
on key DOWN of Win_1 action kytest(2) /* cursor down */
on key Next of Win_1 action kytest(3) /* PgDn */
@ 40, 10 label label_1 value "Str1" width 40
@ 80, 10 label label_2 value "Str2" width 40
@ 120, 10 label label_3 value "Str3" width 40
@ 160, 10 label label_4 value "Str4" width 40
@ 40, 80 TEXTBOX TEXT_1 ;
NUMERIC INPUTMASK "999,999.99"
@ 80, 80 TEXTBOX TEXT_2 value "test"
@ 120, 80 TEXTBOX TEXT_3
@ 160, 80 textbox text_4
END WINDOW
CENTER WINDOW Win_1
ACTIVATE WINDOW Win_1
on key TAB of Win_1 action kytest()
Return
function KyTest(P_1)
do case
case P_1 = 1 /* Cursor Up */
fldptr = fldptr - 1
if fldptr < 1
fldptr := 1
endif
Nav(fldptr)
case P_1 = 2 /* Cursor Down */
fldptr := fldptr + 1
if fldptr > FldMax
fldptr := FldMax
endif
Nav(fldptr)
Case P_1 = 3 /* PgDn - only active in Edit mode */
fldptr := 1
Nav(fldptr)
/* save current record and close Edit mode */
endcase
// msginfo ("Fld Ptr = "+str(fldptr))
return nil
function Nav(P_2)
do case
case P_2 = 1
win_1.text_1.setfocus
case P_2 = 2
win_1.text_2.setfocus
case P_2 = 3
win_1.text_3.setfocus
case P_2 = 4
win_1.text_4.setfocus
endcase
return nil
Re: Odd Behaviour
Posted: Fri Apr 12, 2013 5:37 pm
by Leopoldo Blancas
Hola...
Muy bien !!!
Quiero sugerirte que utilices los controles que hay arriba donde escribes tu Post, hay unos botones que ayudan a mejorar a que se vea mejor el código, hay un botón que se llama "Code" y entre los Code pones tu código para que se vea más claro. Por ejemplo:
Code: Select all
IF nCode == 0
MsgBox("El nCode Vale 0")
ELSE
MsgBox("El nCode NO Vale 0")
END IF
Espero te sirva.
Saludos
Polo
*---------------------------------------------------------------
Hello ...
Very well!
I want to suggest you use the controls that are above where you write your post, there are buttons that help to improve the code look better, there is a button called "Code" and enter the code you put your code to make it look more clear. For example:
Code: Select all
IF nCode == 0
MsgBox ("The nCode Vale 0")
ELSE
MsgBox ("The nCode NOT Vale 0")
END IF
I hope you serve.
regards
Polo
Re: Odd Behaviour
Posted: Fri Apr 12, 2013 5:41 pm
by CalScot
Thank you, Polo.
I hadn't noticed the "Code" option, but it will be very useful!!
Thanks again.
CalScot