home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
SOURCE
/
ACHOICE.PRG
< prev
next >
Wrap
Text File
|
1994-11-29
|
2KB
|
61 lines
/////////////////////////
//
// achoice.prg - alternative ACHOICE() function using Windows list box
//
// Written by: John M. Skelton, 12-May-93.
//
// Copyright (C) 1993 Skelton Software, Kendal Cottage, Hillam, Leeds LS25 5HP, UK.
// All Rights Reserved.
//
/////////////////////////
#define WIN_WANT_LBS
#include "windows.ch"
function achoice(nTop, nLeft, nBottom, nRight, aChoices)
local aDlg, nRet, cText, nX, nY, nW, nH, nDX, nDY
default nTop to 5, nLeft to 5, nBottom to 15, nRight to 45
nDX = C4W_LoWord(GetDialogBaseUnits()) / 2
nDY = C4W_HiWord(GetDialogBaseUnits()) / 2
nX = nLeft * nDX
nY = nTop * nDY
nW = (nRight - nLeft + 1) * nDX + 20
nH = (nBottom - nTop + 1) * nDY + 40
aDlg = CreateDialog("Achoice", ;
WS_CAPTION + WS_SYSMENU + WS_GROUP + WS_TABSTOP ;
+ WS_THICKFRAME + WS_VISIBLE + WS_POPUP, ;
;// 100, 30, 100, 100)
nX, nY, nW, nH)
// You might like to add + LBS_SORT to the WS_* values below...
aDlg = AppendDialog(aDlg, "listbox", DLG_LISTBOX, ;
WS_CHILD + WS_VISIBLE + WS_VSCROLL + WS_BORDER ;
+ WS_TABSTOP + LBS_USETABSTOPS, ;
;// 10, 10, 80, 60, ;
10, 10, nW - 20, nH - 40, ;
aChoices)
aDlg = AppendDialog(aDlg, "ok", DLG_BUTTON, ;
BS_DEFPUSHBUTTON + WS_TABSTOP + WS_CHILD + WS_VISIBLE, ;
;// 10, 75, 35, 15, ;
;// 10, nH - 25, 35, 15, ;
(nW - 80) / 3, nH - 25, 35, 15, ;
"&Ok")
aDlg = AppendDialog(aDlg, "cancel", DLG_BUTTON, ;
BS_PUSHBUTTON + WS_TABSTOP + WS_CHILD + WS_VISIBLE, ;
;// 55, 75, 35, 15, ;
;// nW - 45, nH - 25, 35, 15, ;
2 * (nW - 80) / 3 + 35, nH - 25, 35, 15, ;
"&Cancel")
if ModalDialog(aDlg) = 0 .or. GetDialogResult(aDlg, "cancel") = .T.
nRet = 0
else
cText = GetDialogResult(aDlg, "listbox")
nRet = ascan(aChoices, cText)
endif
return nRet