i have a GET and a BUTTON in oWnd
now i want to use VK_RETURN for ACTION and close oWnd
- Code: Select all Expand view
- PROCEDURE MakeNewFolder()
LOCAL cSourceDir := IF( nGridFocus = 1, cExpl_Left:oGrid:cPath, cExpl_Right:oGrid:cPath )
LOCAL cPath := SPACE( 100 )
LOCAL oWnd, oLabel_1, oText_1, oBtn, oTimer
DEFINE WINDOW oWnd FROM 0, 0 TO 180, 500 PIXEL TITLE "Create New Folder" ICON "A1MAIN" NOMINIMIZE NOMAXIMIZE
@ 010, 010 SAY oLabel_1 PROMPT cSourceDir SIZE 460, 30 PIXEL FONT oFontDefault OF oWnd
@ 040, 010 GET oText_1 VAR cPath SIZE 460, 30 PIXEL FONT oFontDefault OF oWnd
@ 080, 010 BUTTON oBtn PROMPT "&OK" SIZE 460, 50 PIXEL FONT oFontDefault ACTION DoCreateFolder( cSourceDir, cPath ) OF oWnd
oWnd:bKeyDown := { | nKey, nFlag | IF( nKey = VK_ESCAPE, oWnd:End(), IF( nKey = VK_RETURN, ( DoCreateFolder( cSourceDir, cPath ), oWnd:End() ), nil ) ) }
oWnd:bResized := { | nType, nWidth, nHeight | oWnd:SetSize( 500, 180 ) }
DEFINE TIMER oTimer INTERVAL 100 ACTION( SnapToCtrl( oWnd, oBtn, oTimer ), oTimer:End() ) OF oWnd
ACTIVATE TIMER oTimer
#IFDEF __HMG__
END WINDOW
#ENDIF
oText_1:Setfocus()
ACTIVATE WINDOW oWnd ON INIT MakeTop( oWnd ) CENTER
oTimer:End()
RETURN
ESC seem to work but ENTER goes to BUTTON ... hm
---
when have type into GET and press "close" Button (upper - right) i expect "nothing" happens
but it "does" do DoCreateFolder() ... ...hm
have no Idea what is going on
did someone have a Sample how to use ENTER of GET to activate ACTION of "Ok" Button
need some help please