home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
SOURCE
/
BUTTON2.PRG
< prev
next >
Wrap
Text File
|
1995-07-09
|
2KB
|
78 lines
////////////////////////////
//
// Clip-4-Win button demo (same as source\button.prg but using commands)
//
// Copyright (C) 1992 Skelton Software, Kendal Cottage, Hillam, Leeds, UK.
// All Rights Reserved.
//
// To build: c4wbuild button2
//
////////////////////////////
#define WIN_WANT_ALL
#include "windows.ch"
#define NO_C4WCLASS
#include "commands.ch"
// these need to be different so we know which button was selected
#define BTN1 1
#define BTN2 2
#define nstr(i) alltrim(str(i))
function main()
local oApp, oWnd
local hDefPushButton, hPushButton
CREATE APPLICATION oApp WINDOW oWnd TITLE "Clip-4-Win button demo" ;
ON INIT DoInit(oWnd, @hDefPushButton, @hPushButton) ;
ON WM_COMMAND OnCommand(@hDefPushButton, @hPushButton)
return nil
static function DoInit(hWnd, hDefPushButton, hPushButton)
CREATE WINDOW hPushButton CLASS "button" INSTANCE 0 ;
TITLE "&PushButton" ;
STYLE WS_CHILD + WS_VISIBLE + WS_TABSTOP + WS_GROUP + BS_PUSHBUTTON ;
AT 100,150 SIZE 150,20 ID BTN2 IN hWnd
CREATE WINDOW hDefPushButton CLASS "button" INSTANCE 0 ;
TITLE "&DefPushButton" ;
STYLE WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_DEFPUSHBUTTON ;
AT 350,150 SIZE 150,20 ID BTN1 IN hWnd
SetFocus(hDefPushButton)
return nil
static function OnCommand(hDefPushButton, hPushButton, hWnd, nMsg, nwParam)
local nButton := nwParam
MessageBox( , "Button number: " + nstr(nButton), "Info", MB_OK)
if nButton == BTN1
DestroyWindow(hDefPushButton)
hDefPushButton = nil
if !empty(hPushButton)
SetFocus(hPushButton)
endif
endif
if nButton == BTN2
DestroyWindow(hPushButton)
hPushButton = nil
if !empty(hDefPushButton)
SetFocus(hDefPushButton)
endif
endif
if empty(hDefPushButton) .and. empty(hPushButton)
MessageBox( , "Press ENTER to exit", "All buttons pressed", MB_OK)
quit
endif
return nil