I try to build a dialog asociated with a xbrowse . The dialog is build when the browse receives focus and updated with bChange
1) I don't understand what is happening when the showdlg is closed with the mouse (right upper corner) . When the record changes in the browse , bchange is executed. oDlg is not nil , the program knows odlg:cCaption , oDlg:lVisible is .F. , so i try to show the dialog again , without succes
2) I try to update the dialog only when VK_DOWN or VK_UP is released , during pressing it the dialog must not be updated
It seems impossible :
IF GetKeyState(VK_DOWN) .OR. GetKeyState(VK_UP)
RETURN
END
Pressing one from the keys (also very short) executes always RETURN , nothing is updated
DO WHIL GetAsyncKey(VK_DOWN) .OR. GetAsyncKey(VK_UP)
END
This works partially , pressing one from the keys the program continues only when the key is released. So we have to press again for each row
CUSTOMER.DBF see fwh\samples
- Code: Select all Expand view
# include "FiveWin.ch"
# include "xbrowse.ch"
#xtranslate ISNIL( <xValue> ) => HB_ISNIL( <xValue> )
PROC MAIN()
************
LOCAL oDlg , oBrw , oDDlg
DEFINE DIALOG oDlg TITLE "PROG1" FROM 5,10 TO 50 ,60
@ 0,0 XBROWSE oBrw OF oDlg ALIAS "CUSTOMER" ;
AUTOCOLS FOOTERS LINES CELL
oBrw:bGotFocus := {||ShowDlg(@oDDlg,oBrw,.T.)}
oBrw:bChange := {||ShowDlg(@oDDlg,oBrw,.F.)}
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg; //NOMODAL;
VALID IIF(! IsNil(oDdlg) , oDdlg:end() , ) CENTER
RETURN
***********************************************************************************************
PROC ShowDlg(oDlg,oBrw,lMode)
******************
LOCAL oSay
//DO WHIL GetAsyncKey(VK_DOWN) .OR. GetAsyncKey(VK_UP)
//END
IF GetKeyState(VK_DOWN) .OR. GetKeyState(VK_UP)
//RETURN
END
IF IsNil(oDlg) .AND. lMode
DEFINE DIALOG oDlg FROM 5,30 TO 20 , 50 TITLE "test"
@ 0,0 SAY oSay VAR CUSTOMER->First
ACTIVATE DIALOG oDlg NOWAIT ON INIT xSetFocus(oBrw)
ELSE
IF ! oDlg:lVisible
//oDlg:Show()
oDlg:Restore()
tracelog(oDlg:cCaption,oDlg:lActive,oDlg:lVisible,oDlg:lFocused,oDlg:lCancel)
END
oSay := oDlg:aControls[1]
oSay:SetText(CUSTOMER->First)
oSay:Refresh()
ENDIF
RETURN
*****************************************************************************************
function xSetFocus( oObx )
**************************
// function from local.fivewin.english 4/1/2003 Kleyber Derick
local oTempo:=""
local lGet := oObx:ClassName $ "TGET TMULTIGET"
define timer oTempo interval 10 of oObx:oWnd ;
action (oObx:SetFocus(), IIF(lGet , oObx:SetPos(0) , ), oTempo:Deactivate() )
activate timer oTempo
return nil
******************************************************************************************
INIT proc Start()
************
USE CUSTOMER
RETURN