James Bott wrote:Try oGet:bKeyDown or oGet:bKeyChar
James
Antonio Linares wrote:Wanderson,
You could also do:
nAt := AScan( Folder1:aDialogs[1]:aControls, { | oCtrl | GetFocus() == oCtrl:hWnd } )
Folder1:aDialogs[1]:aControls[ nAt ] // this is the focused control
In my function how i can get a id of the get control when i press the function key?
James Bott wrote:Wanderson,In my function how i can get a id of the get control when i press the function key?
oGet:end()
oDlg:refresh()
However, this is not standard behavior so users will most likely be confused by it. I would suggest that irrelevant controls should be shown as disabled. This disabling should be under program control not user control.
Perhaps if you explained in more detail what you are trying to do, we could be of more help.
Regards,
James
Antonio Linares wrote:Wanderson,
Simply do:
SET KEY VK_F5 TO Man_Vei()
DEFINE DIALOG ...
ACTIVATE DIALOG ...
#Include "FiveWin.Ch"
static nGet := 0
Function Main()
Local oDlg
Local oGet1,oGet2,oGet3
local cVar1 := space(10)
local cVar2 := space(10)
local cVar3 := space(10)
SET KEY VK_F5 TO Man_Vei()
DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL
@ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
oGet1:bKeyDown := { | nKey | IIF( nKey == VK_F5, nGet := 1, ) }
@ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
oGet2:bKeyDown := { | nKey | IIF( nKey == VK_F5, nGet := 2, ) }
@ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL
ACTIVATE DIALOG oDlg
RETURN NIL
// ----------------------
Static Function Man_Vei()
local VarRet := ""
DO CASE
CASE nGet == 1
VarRet := "XXXXX"
MsgInfo( VarRet )
CASE nGet == 2
VarRet := "YYYYY"
MsgInfo( VarRet )
ENDCASE
nGet := 0
Return VarRet
#Include "FiveWin.Ch"
static nGet := 0
Function Main()
Local oDlg
Local oGet1,oGet2,oGet3
local cVar1 := space(10)
local cVar2 := space(10)
local cVar3 := space(10)
SET KEY VK_F5 TO Man_Vei()
DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL
@ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
oGet1:bGotFocus := { || nGet := 1 }
oGet1:bLostFocus := { || nGet := 0 }
@ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
oGet2:bGotFocus := { || nGet := 2 }
oGet2:bLostFocus := { || nGet := 0 }
@ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL
ACTIVATE DIALOG oDlg
RETURN NIL
// ----------------------
Static Function Man_Vei()
local VarRet := ""
DO CASE
CASE nGet == 1
VarRet := "XXXXX"
MsgInfo( VarRet )
CASE nGet == 2
VarRet := "YYYYY"
MsgInfo( VarRet )
ENDCASE
Return VarRet
#Include "FiveWin.Ch"
Function Main()
Local oDlg
Local oGet1,oGet2,oGet3
local cVar1 := space(10)
local cVar2 := space(10)
local cVar3 := space(10)
//SET KEY VK_F5 TO Man_Vei( )
SetKey( VK_F5, {|p, l, v| Man_Vei( oDlg )} )
DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL
@ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
oGet1:cargo := 'XXXXX'
@ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
oGet2:cargo := 'YYYYY'
@ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL
ACTIVATE DIALOG oDlg
RETURN NIL
// ----------------------
static function Man_Vei( oDlg )
local nCounter, cVarRet
for nCounter := 1 TO LEN( oDlg:aControls )
if oDlg:aControls[ nCounter ]:lFocused
cVarRet := oDlg:aControls[ nCounter ]:cargo
exit
endif
next
if cVarRet != nil
msginfo( cVarRet )
endif
return cRetVar
avista wrote:You can try this 2 samples
- Code: Select all Expand view RUN
#Include "FiveWin.Ch"
static nGet := 0
Function Main()
Local oDlg
Local oGet1,oGet2,oGet3
local cVar1 := space(10)
local cVar2 := space(10)
local cVar3 := space(10)
SET KEY VK_F5 TO Man_Vei()
DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL
@ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
oGet1:bKeyDown := { | nKey | IIF( nKey == VK_F5, nGet := 1, ) }
@ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
oGet2:bKeyDown := { | nKey | IIF( nKey == VK_F5, nGet := 2, ) }
@ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL
ACTIVATE DIALOG oDlg
RETURN NIL
// ----------------------
Static Function Man_Vei()
local VarRet := ""
DO CASE
CASE nGet == 1
VarRet := "XXXXX"
MsgInfo( VarRet )
CASE nGet == 2
VarRet := "YYYYY"
MsgInfo( VarRet )
ENDCASE
nGet := 0
Return VarRet
- Code: Select all Expand view RUN
#Include "FiveWin.Ch"
static nGet := 0
Function Main()
Local oDlg
Local oGet1,oGet2,oGet3
local cVar1 := space(10)
local cVar2 := space(10)
local cVar3 := space(10)
SET KEY VK_F5 TO Man_Vei()
DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL
@ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
oGet1:bGotFocus := { || nGet := 1 }
oGet1:bLostFocus := { || nGet := 0 }
@ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
oGet2:bGotFocus := { || nGet := 2 }
oGet2:bLostFocus := { || nGet := 0 }
@ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL
ACTIVATE DIALOG oDlg
RETURN NIL
// ----------------------
Static Function Man_Vei()
local VarRet := ""
DO CASE
CASE nGet == 1
VarRet := "XXXXX"
MsgInfo( VarRet )
CASE nGet == 2
VarRet := "YYYYY"
MsgInfo( VarRet )
ENDCASE
Return VarRet
Regards,
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], MaxP, Timm Sodtalbers and 60 guests