hi,
it "seems" me that i can use ALT + F5 only "as Menu Key"
for this i need ACCELERATOR ACC_ALT "Key" ... but how to get it e.g. ALT + F5 under Fivewin
Compiling 'testtcb3.prg' and generating preprocessed output to 'testtcb3.ppo'...
2 errors
No code generated.
testtcb3.prg(105) Error E0030 Syntax error "syntax error at 'COLUMN'"
testtcb3.prg(111) Error E0030 Syntax error "syntax error at 'COLUMN'"
* Compile errors *
#define VK_F5 0x74
ACCELERATOR ACC_ALT, VK_F5
ACCELERATOR ACC_ALT, 65652 ;
// C:\FWH..\SAMPLES\TESTTCB3.PRG
// Reviewing arrays - using FiveWin TCBrowse
#include "FiveWin.ch"
#include "TCBrowse.ch"
//----------------------------------------------------------------------------//
static oWnd
function Main()
DEFINE WINDOW oWnd FROM 0, 0 TO 29, 78 TITLE FWVERSION + ;
" - Generic Testing Window" MENU BuildMenu()
SET MESSAGE OF oWnd TO "Main window messages go here" ;
CLOCK DATE KEYBOARD
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "&Test" MESSAGE "Alt-F5 to Call Test Array Browse" ;
ACTION TestBrw() ;
ACCELERATOR ACC_ALT, VK_F5
MENUITEM "&Exit" MESSAGE "Quit the program" ;
ACTION oWnd:End()
ENDMENU
return oMenu
//----------------------------------------------------------------------------//
Function TestBrw()
local oBrw, nI, aTestData, uVar, oBtn, oFont
local oWndChild, oDlg, oBar, oMsg
local cName := "Testing..."
CursorWait()
// load some fields into a multi element array,
USE Customer // or some other way to...
aTestData := Array( LastRec(), 4 ) // make the array
FOR nI := 1 TO Len(aTestData)
aTestData[nI,1] := Field->Salary // numb
aTestData[nI,2] := PadR(Trim(Field->First)+ " "+Trim(Field->Last), 50)
// need to pad char array element for editing beyond last character
aTestData[nI,3] := Field->Married // logical
aTestData[nI,4] := Field->HireDate // date
IF .NOT.EOF()
SKIP
ENDIF
NEXT
USE
DEFINE DIALOG oDlg FROM 2,2 TO 24, 75 OF oWnd TITLE "Test Multi Col Array"
@ 1.5, 1 COLUMN BROWSE oBrw OF oDlg ;
ON LEFT DBLCLICK EditCell( oBrw, nRow, nCol ) ;
SIZE 170, 135 MESSAGE "Multi-Element Array Column Browse"
oBrw:SetArray( aTestData )
oBrw:nClrForeHead := CLR_WHITE
oBrw:nClrBackHead := CLR_BLUE
// oBrw:bLDblClick = { | nRow, nCol | EditCell( oBrw, nRow, nCol ) }
// oBrw:lNoLiteBar := .t. // get rid of the lite bar cursor
// oBrw:lNoGrayBar := .t. // get rid of that ugly gray bar on lost focus
// oBrw:lMChange := .t. // set false to prevent Mouse colm resize/drag
oBrw:lLogicDrop := .t. // use crazy logic dropbox
oBrw:lNoHScroll := .t. // don't use that pesky horiz scroll bar
oBrw:nAdjColumn := 3 // expand this column to flush table right
oBrw:nFreeze := 5 // This will freeze all & prevent horiz scrolling
// NOTE can't resize/drag on frozen columns
ADD COLUMN TO BROWSE oBrw DATA oBrw:nAt ; // array element number
SIZE 30 NOBAR CENTER COLOR CLR_BLACK, CLR_HGRAY ;
HEADER "No"
ADD COLUMN TO oBrw DATA ARRAY ELEM 1 ;
HEADER "Salary " SIZE 60 PICTURE "999,999" RIGHT ;
EDITABLE
ADD TO oBrw ARRAY ELM 2 ;
HEADER " Name" EDIT MESSAGE "First and Last Names" ;
SIZE 10 PICTURE "@S50" // size is small since will nAdjColumn width
ADD COLUMN TO oBrw ARRAY ELEM 3 ;
HEADER "Log" SIZE 30 CENTER ;
MESSAGE "Logical Variable" ; // PICT "Y" ;
// EDIT VALID IF x == "Yes" /*;
// ERROR MESSAGE "Only True is allowed"*/
ADD COLUMN TO oBrw DATA ARRAY ELEMENT 4 ;
HEADER "HireDate" SIZE 65 PICTURE "@D" CENTER ;
MESSAGE "His hire date" ;
// EDIT VALID IF x < CtoD("12/31/93") .and. x > CtoD("12/31/90") ;
// ERROR MSG "Date must be between"+CRLF+"12/31/90 and 12/31/93"
@ 0.2, 1 BUTTON "E&xit" OF oDlg SIZE 30,12 ACTION oDlg:End() ;
MESSAGE "Get outta here"
@ 0.2, 8 BUTTON "&Edit" OF oDlg SIZE 30,12 ;
ACTION EditAllColms(oBrw) ;
MESSAGE "Edit all data columns - left to right"
@ 0.2, 18 SAY "Dbl Click to Edit, ESC to abort Editing..." OF oDlg
ACTIVATE DIALOG oDlg
return nil
//----------------------------------------------------------------------------//
FUNCTION EditAllColms(oLbx)
local nI, uVar, cPic, cMsg, bValid, cErr
local lNoGrayBar := oLbx:lNoGrayBar
oLbx:lNoGrayBar := .f. // make sure line is grayed while editing
For nI := 2 To Len(oLbx:aArray[1])+1 //Len(aTestData[1])
uVar := Eval(oLbx:aColumns[nI]:bData) // get value
cPic := oLbx:aColumns[nI]:cPicture
cMsg := oLbx:aColumns[nI]:cMsg
cErr := oLbx:aColumns[nI]:cError
bValid := oLbx:aColumns[nI]:bValid
If oLbx:lEditCol( nI, @uVar, cPic, bValid , CLR_WHITE, CLR_RED, ;
cMsg, cErr )
// next only works with Field/Memory Blocks
Eval(oLbx:aColumns[nI]:bData, uVar )
oLbx:DrawSelect() // showit
Else
EXIT
Endif
Next
oLbx:lNoGrayBar := lNoGrayBar
oLbx:SetFocus() // refocus on the browse
RETURN Nil
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 101 guests