home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
SOURCE
/
CONTRIB
/
ENTER.ZIP
/
TEST.PRG
< prev
next >
Wrap
Text File
|
1996-01-26
|
4KB
|
133 lines
// Original by Paul Richards. Minor clean-ups by JMS
#define WIN_WANT_HELP
#define WIN_WANT_ALL
#include "windows.ch"
#define NO_C4WCLASS
#include "commands.ch"
#include "dialog.ch"
Static GetList
Static Get1
Static Get2
Static Get3
Static Get4
Static Get5
Static Get6
Static hWnd
Function Main()
local oApp, oWnd
CREATE APPLICATION oApp WINDOW oWND TITLE "Clip-4-Win Get Test" ;
ON INIT MenuSetup(oWnd)
return nil
static function MenuSetup(oWnd)
hWnd := oWnd
MENU IN oWnd
POPUP "&File"
MENUITEM "E&xit" ACTION DoExit()
ENDPOPUP
POPUP "&Get Test"
MENUITEM "&Test" ACTION GetTest()
ENDPOPUP
ENDMENU
return nil
Function DoExit()
Quit
Return NIL
Function GetTest()
// Load Dialog Box and Return
Return DialogBox(_GetInstance() , "TEST",,; // Load Dialog
{|hDlg, nMsg, nWparam, nLparam|;
GetFn(hDlg,nMsg,nWparam,nLparam)})
Static Function GetFn(hDlgWnd,nMsg,nWparam,nLparam)
LOCAL nGet
Set Confirm On // Most Important for the last Get
do Case
Case nMsg == WM_INITDIALOG
GetList := {}
// Dialog Box Header
Get1 := Get2 := Get3 := Get4 := Get5 := Get6 := Space(20)
@ Dialog hDlgWnd ID 101 get Get1
@ Dialog hDlgWnd ID 102 get Get2
@ Dialog hDlgWnd ID 103 get Get3
@ Dialog hDlgWnd ID 104 get Get4
@ Dialog hDlgWnd ID 105 get Get5
@ Dialog hDlgWnd ID 106 get Get6
SendMessage(hDlgWnd,WM_SETTEXT,0,"Get Test")
Return(1)
Case nMsg == WM_COMMAND
Do Case
Case nWparam == IDCANCEL // Finished
Cancel Dialog hDlgWnd
EndDialog(hDlgWnd,IDCANCEL)
Return(1)
Case nWParam >= 200 .and. nWParam <= 206 // PICK 1
PickList(hDlgWnd,nWparam-200)
Case nWParam == 501 // ACCEPT
MessageBox(hDlgWnd,"Validate Gets"+chr(10)+chr(13)+;
"and Write to dBF","Accepting Dialog",MB_OK)
Cancel Dialog hDlgWnd
EndDialog(hDlgWnd,IDOK)
Return(1)
Case nWParam == IDOK // Enter Depressed
if GetDlgCtrlID(GetFocus()) == 101 // Take care of up
GetList[2]:setFocus() // key depressed in
SetFocus(GetDlgItem(hDlgWnd,102)) // first get
else
// which read has focus
for nGet := 1 to len(GetList)
if GetList[nGet]:hasfocus
exit
endif
next
// if Move to next Get or to next button
if nGet < len(GetList)
nGet++
GetList[nGet]:setFocus()
SetFocus(GetDlgItem(hDlgWnd,100+nGet))
else
// Move TABSTOP Focus to Accept Button
PostMessage(hDlgWnd,WM_NEXTDLGCTL,GetDlgItem(hDlgWnd,501),1)
endif
endif
EndCase
EndCase
RETURN(0)
/////////////////////////////////
Function PickList(hDlgWnd,nGet)
/////////////////////////////////
Local nPick := "Pick List Value "+str(nGet,1,0)
MessageBox(hDlgWnd,"Pop up a pick list","Pick List",MB_OK)
GetList[nGet]:KillFocus() // Update GetList Object Focus
GetList[nGet]:varPut(nPick) // Update GetList Object
SetDlgItemText(hDlgWnd,100+nGet,nPick) // Update Dialog item
SetFocus(GetDlgItem(hDlgWnd,100+nGet)) // Set Focus
GetList[nGet]:SetFocus() // to Picked Get
Return NIL