#include "FiveWin.ch"
#include "xbrowse.ch"
FUNCTION MAIN()
Local odlg, oSay[9]
Local aSudoku := { { " ", " ", " ", "2", " ", "3", "8", " ", "1" }, ;
{ " ", " ", " ", "7", " ", "6", " ", "5", "2" }, ;
{ "2", " ", " ", " ", " ", " ", " ", "7", "9" }, ;
{ " ", "2", " ", "1", "5", "7", "9", "3", "4" }, ;
{ " ", " ", "3", " ", " ", " ", "1", " ", " " }, ;
{ "9", "1", "7", "3", "8", "4", " ", "2", " " }, ;
{ "1", "8", " ", " ", " ", " ", " ", " ", "6" }, ;
{ "7", "3", " ", "6", " ", "1", " ", " ", " " }, ;
{ "6", " ", "5", "8", " ", "9", " ", " ", " " } }
Local aPrompt := { " a", " b", " c", " d", " e", " f", " g", " h", " i" }
DEFINE DIALOG oDlg SIZE 81*5,81*5;
COLOR CLR_BLACK,CLR_WHITE PIXEL
I := 1
nRow := 20
FOR I := 1 TO 9
@ nRow, 8 SAY oSay[I] PROMPT aPrompt[I] SIZE 12, 9 COLOR 0, 16772055 PIXEL
nRow := nRow +9
NEXT
@ 10, 20 XBROWSE oBrw OF oDlg ARRAY aSudoku ;
LINES CELL cols{ 1,2,3,4,5,6,7,8,9 } ;
HEADER "1", "2", "3", "4","5","6", "7","8","9" ;
COLSIZES 25, 25, 25, 25, 25, 25, 25, 25, 25, 25 ;
SIZE 125, 91 NOBORDER PIXEL
oBrw:bLClicked := { | nRow, nCol | C_ACTION( aSudoku, oBrw:KeyNo(), oBrw:SelectedCol():nCreationOrder, aPrompt ) }
Ut_BrwRowConfig( oBrw )
oBrw:CreateFromCode()
aeval( oBrw:aCols, { |oCols| oCols:nEditType := EDIT_GET, ;
oCols:lAllowSizing := .F., ;
oCols:nDataStrAlign := AL_CENTER } )
ACTIVATE DIALOG oDlg
RETURN NIL
// ---------
FUNCTION C_ACTION(aSudoku, nRPos, nCPos, aPrompt)
IF EMPTY( aSudoku[nRPos][nCPos] )
MsgAlert( "Row : " + aPrompt[nRPos] + CRLF + ;
"Col : " + ALLTRIM(STR(nCPos)), "Position" )
ENDIF
RETURN(NIL)
// ------
FUNCTION Ut_BrwRowConfig( oBrw )
oBrw:lRecordSelector := .F. // .t.
oBrw:lAllowRowSizing := .F.
oBrw:lColDividerComplete := .t. // .f.
oBrw:lAllowColSwapping := .f.
oBrw:lAllowColHiding := .f.
oBrw:lFastEdit := .f.
oBrw:nRowSel := 1
oBrw:nColSel := 1
oBrw:nColOffset := 1
oBrw:nFreeze := 0
oBrw:nCaptured := 0
oBrw:nLastEditCol := 0
oBrw:nStretchCol := -1
oBrw:lRecordSelector := .F.
oBrw:lHScroll := .F.
oBrw:lVScroll := .F.
oBrw:nRowDividerStyle := LINESTYLE_LIGHTGRAY
oBrw:nColDividerStyle := LINESTYLE_LIGHTGRAY // LINESTYLE_NOLINES
* oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW // MARQSTYLE_SOLIDCELL
oBrw:lheader :=.t.
RETURN nil