I'm trying to capture a scanned code ( UPC : Universal Part Code ) into the Get, as keyboard input followed by a CRLF.
Then, the code is added to the array that is displayed in the browse.
No problem doing this. However, I then want the GET field to be blank and put back into focus.
I can use a VALID to execute everything except putting the cursor back in the single GET field. Right now I can do the scan, which puts the code into the GET, and the CRLF makes it add to the browse list, and a refresh clears the data. However I then have to click on the GET field for it to be in focus.
- Code: Select all Expand view
METHOD BuildBarCodeList() CLASS tWorkorder
LOCAL aBrowseCodes := {}, lAddItems := .f., cBarCode := SPACE(30)
// Display dialog
DEFINE DIALOG oBCdlg1 RESOURCE "WOBARCODE" TRANSPARENT OF oWnd TITLE "Input from barcode reader"
REDEFINE GET oBC1 VAR cBarCode ID 200 OF oBCdlg1 UPDATE ;
VALID ( AADD( aBrowseCodes, cBarCode),;
oLbc1:update(),;
cBarCode := SPACE(30),;
oBCdlg1:update(), .t.)
[b]// Trying to add oBC1:setfocus() to the valid causes a compile syntax error[/b]
// Create the list control
REDEFINE XBROWSE oLbc1 ;
DATASOURCE aBrowseCodes ;
ID 300 OF oBCdlg1 ;
HEADERS " Partnumber " ;
COLUMNS 1 ;
AUTOSORT UPDATE
// Provide the header gradient
oLbc1:bClrGrad := aPubGrad
// Set the styles
oLbc1:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbc1:nColDividerStyle := LINESTYLE_RAISED
oLbc1:nRowDividerStyle := LINESTYLE_RAISED
oLbc1:nHeadStrAligns := AL_CENTER
oLbc1:nStretchCol := STRETCHCOL_LAST
REDEFINE BUTTONBAR oBCBarA ID 100 SIZE 60,60 OF oBCdlg1 2015
oBCBarA:bClrGrad := aPubGrad
DEFINE BUTTON oBtnBC1 OF oBCBarA RESOURCE "HRADD" PROMPT "Add" TOOLTIP "Add parts to the workorder" ;
ACTION ( lAddItems := .t., oBCdlg1:end( ) )
DEFINE BUTTON oBtnBC2 OF oBCBarA RESOURCE "HREXIT" PROMPT "Exit" TOOLTIP "Exit the without adding" ;
ACTION oBCdlg1:end( )
// Activate the dialog screen
ACTIVATE DIALOG oBCdlg1 CENTERED
RETURN nil
Any thoughts on how to resolve this ?