Thanks for all support.
Will try again later, the only working browse was using array as reference.
There are more things to be done.
shell station map
My current basic test is:
- My application using gtwvg and multithread
- fivewin called from menu on one thread, more than one thread, crash all.
- there are 5 browses, but 2 are on anothers tab, not visible on image
current source code, for all browses is this:
Code: Select all | Expand
STATIC FUNCTION gui_Browse( xDlg, xParent, xControl, nRow, nCol, nWidth, nHeight, oTbrowse, ;
cField, xValue, workarea, aKeyDownList, oFrmClass )
LOCAL aItem, oCol, aThisKey, nPos
#ifdef DLGAUTO_AS_LIB
LOCAL aCol, nValue
#endif
IF oFrmClass:lIsSQL
#ifdef DLGAUTO_AS_LIB
IF Len( aKeyDownList ) == 0
@ nRow, nCol XBROWSE xControl ;
ARRAY Array(10) ;
SIZE nWidth, nHeight PIXEL ;
; // LINES AUTOCOL, AUTOSORT ;
OF xParent ;
ON DBLCLICK gui_BrowseDblClick( xDlg, xControl, workarea, cField, @xValue )
//LINES CELL
ELSEIF ( nPos := hb_AScan( aKeyDownList, { | e | e[1] == VK_RETURN } ) ) != 0
@ nRow, nCol XBROWSE xControl ;
ARRAY Array(10) ;
; // LINES AUTOCOL, AUTOSORT ;
SIZE nWidth, nHeight PIXEL ;
OF xParent ;
ON DBLCLICK GUI():BrowseKeyDown( VK_RETURN, aKeyDownList, workarea )
//LINES CELL
ENDIF
WITH OBJECT xControl
//:nDataType := DATATYPE_USER
xControl:xUserData := ADOLocal()
xControl:xUserData:Execute( "SELECT * FROM " + workarea + ;
iif( "BROWSE" $ oFrmClass:cTitle, "LIMIT 5 ", "" ) + ;
" ORDER BY " + oTbrowse[ 1, 1 ] )
xControl:xUserValue := xControl:xUserData:RecordCount()
:nArrayAt := 1
ADD oCol TO xControl ;
DATA { || xControl:nArrayAt } ;
HEADER "#ArrayAt" ;
PICTURE "999999"
FOR EACH aItem IN oTbrowse
DO CASE
CASE Len( aItem ) < 4
ADD oCol TO xControl ;
DATA { || xControl:xUserData:Value( aItem[2] ) } ;
HEADER aItem[1] ;
//PICTURE aItem[3]
CASE aItem[ 4 ] == "D"
ADD oCol TO xControl ;
DATA { || xControl:xUserData:Date( aItem[2] ) } ;
HEADER aItem[1] ;
//PICTURE aItem[3]
CASE aItem[ 4 ] == "N"
ADD oCol TO xControl ;
DATA { || xControl:xUserData:Number( aItem[2] ) } ;
HEADER aItem[1] ;
//PICTURE aItem[3]
OTHERWISE
ADD oCol TO xControl ;
DATA { || xControl:xUserData:String( aItem[2] ) } ;
HEADER aItem[1] ;
//PICTURE aItem[3]
ENDCASE
NEXT
//:bGoTop := { || xControl:xUserValue := 1 }
//:bGoBottom := { || xControl:xUserValue := 10 } // :oRs:RecordCount() }
//:bKeyCount := { || xControl:xUserValue := 10 } // :oRs:RecordCount() } // Use this instead of bLogicLen
//:bBof := { || xControl:xUserValue < 1 }
//:bEof := { || xControl:xUserValue > 10 }
//:bSkip := { |n,nSave| nSave := xControl:xUserValue, ;
// xControl:xUserValue := Max( 1, Min( 10, xControl:xUserValue + IfNil(n,0) ) ), ;
// xControl:xUserValue - nSave } // return number of rows actually skipped
//:bBookMark := ;
//:bKeyNo := { |n| If( n == nil, xControl:xUserValue, xControl:xUserValue := n ) }
:bOnSkip := { || xControl:xUserData:Move( xControl:nArrayAt - 1, 1 ) }
xControl:SetArray( Array( xControl:xUserData:RecordCount() ) )
ENDWITH
#endif
ELSE
IF Len( aKeyDownList ) == 0
@ nRow, nCol XBROWSE xControl ;
SIZE nWidth, nHeight PIXEL ;
DATASOURCE workarea ;
OF xParent ;
ON DBLCLICK gui_BrowseDblClick( xDlg, xControl, workarea, cField, @xValue )
//LINES CELL
ELSEIF ( nPos := hb_AScan( aKeyDownList, { | e | e[1] == VK_RETURN } ) ) != 0
@ nRow, nCol XBROWSE xControl ;
SIZE nWidth, nHeight PIXEL ;
DATASOURCE workarea ;
OF xParent ;
ON DBLCLICK GUI():BrowseKeyDown( VK_RETURN, aKeyDownList, workarea )
//LINES CELL
ENDIF
FOR EACH aItem IN oTbrowse
ADD oCol TO xControl ;
DATA { || (workarea)->(FieldGet(FieldNum( aItem[2] ) ) ) } ;
HEADER aItem[1] ;
PICTURE aItem[3]
NEXT
ENDIF
xControl:CreateFromCode()
xControl:Refresh() // test for bug
/* create buttons on browse for defined keys */
IF Len( aKeyDownList ) != 0
FOR EACH aThisKey IN aKeyDownList
AAdd( oFrmClass:aControlList, EmptyFrmClassItem() )
Atail( oFrmClass:aControlList )[ CFG_CTLTYPE ] := TYPE_BUTTON_BRW
gui_ButtonCreate( xDlg, xParent, @Atail( oFrmClass:aControlList )[ CFG_FCONTROL ], ;
nRow - APP_LINE_SPACING, 200 + aThisKey:__EnumIndex() * APP_LINE_HEIGHT, ;
APP_LINE_HEIGHT - 2, APP_LINE_HEIGHT - 2, "", ;
iif( aThisKey[1] == VK_INSERT, "ICOPLUS", ;
iif( aThisKey[1] == VK_DELETE, "ICOTRASH", ;
iif( aThiskey[1] == VK_RETURN, "ICOEDIT", Nil ) ) ), aThisKey[2] )
NEXT
xControl:bKeyDown := { | nKey | GUI():BrowseKeyDown( nKey, aKeyDownList ) }
ENDIF
(xDlg);(cField);(xValue);(workarea);(aKeyDownList);(xControl);(nRow);(nCol);(nWidth)
(nHeight);(oTBrowse);(oCol)
(xValue)
RETURN Nil
setup for folderex browses is this:
Code: Select all | Expand
cTxt += '[ "BROWSELIST",[' + hb_Eol()
cTxt += '[ "cDbfOrigin", "cFieldName", "cDbfTarget", "nOrder", "cFieldTarget", "cTargetKey", "lEdit", "cTitle" ],' + hb_Eol()
cTxt += '[ "JPCADASTRO", "IDCADASTRO", "JPFINAN", 2, "FICADASTRO", "IDFINAN", true, "FINANCEIRO" ],' + hb_Eol()
cTxt += '[ "JPCADASTRO", "IDCADASTRO", "JPFINAN", 2, "FICADASTRO", "IDFINAN", true, "FINANCEIRO" ],' + hb_Eol()
cTxt += '[ "JPCADASTRO", "IDCADASTRO", "JPFINAN", 2, "FICADASTRO", "IDFINAN", true, "FINANCEIRO" ],' + hb_Eol()
cTxt += '[ "JPCADASTRO", "IDCADASTRO", "JPFINAN", 2, "FICADASTRO", "IDFINAN", true, "FINANCEIRO" ]' + hb_Eol()
cTxt += ']],' + hb_Eol()
browse fields comes from tables on MySQL - current test is using MySQL, but could be done using DBF too.
browses on folderex are to selected code.
browse window is called clicking on button "view".