I changed the Popup-menu to xBrowse with a small Problem.
The defined xBrowse-LostFocus-Color doesn't work.
oBrw:bClrSelect = { || { 0, 16638387 } }Changes for a xBrowse-Popup-menu :
// Round Table
// -------------------
oBmp[7]:bPainted := {|hDC| DRAW_TXT( oBmp[7], hDC, oBtnFont, "7", 0, 128 ) }
oBmp[7]:bRClicked := { ||
ShowPopUp( oDlg, oBmp[7]:nTop + 100, oBmp[7]:nLeft + 70, "ROUND" ), ;
nMENPOS[7] := nSelect, BMP_CHANGE( nSelect, 7, "ROUND"), ;
IIF( nSelect = 6, ( oBmp[7]:nLeft := 880, oBmp[7]:nTop := 25, ; // Stop
oBmp[7]:LoadBMP( "Round1.bmp" ), oBmp[7]:Refresh() ), NIL ) }
// Square Table
// -------------------
oBmp[1]:bPainted := {|hDC| DRAW_TXT( oBmp[1], hDC, oBtnFont, "1", 0, 128 ) }
oBmp[1]:bRClicked := { ||
ShowPopUp( oDlg, oBmp[1]:nTop + 100, oBmp[1]:nLeft + 70, "SQUARE" ), ;
nMENPOS[1] := nSelect, BMP_CHANGE( nSelect, 1, "SQUARE"), ;
IIF( nSelect = 6, ( oBmp[1]:nLeft := 800, oBmp[1]:nTop := 25, ; // Stop
oBmp[1]:LoadBMP( "Square1.bmp" ), oBmp[1]:Refresh() ), NIL ) }
// --------------------------------------
FUNCTION ShowPopup( oDlg, nRow, nCol, cStyle )
LOCAL oDlg1, oBrw, aArray:={}
IF cSTYLE = "SQUARE"
aadd( aArray, { "", " 1", "Free", "Square1.bmp", 255 } )
aadd( aArray, { "", " 2", "Occupated", "Square2.bmp", 255 } )
aadd( aArray, { "", " 3", "Cash", "Square3.bmp", 255 } )
aadd( aArray, { "", " 4", "Attending", "Square4.bmp", 255 } )
aadd( aArray, { "", " 5", "Reservation", "Square5.bmp", 255 } )
aadd( aArray, { "", " 6", "Stop", "Reset.bmp", 255 } )
ELSE
aadd( aArray, { "", " 1", "Free", "Round1.bmp", 255 } )
aadd( aArray, { "", " 2", "Occupated", "Round2.bmp", 255 } )
aadd( aArray, { "", " 3", "Cash", "Round3.bmp", 255 } )
aadd( aArray, { "", " 4", "Attending", "Round4.bmp", 255 } )
aadd( aArray, { "", " 5", "Reservation", "Round5.bmp", 255 } )
aadd( aArray, { "", " 6", "Stop", "Reset.bmp", 255 } )
ENDIF
DEFINE DIALOG oDlg1 FROM nRow, nCol TO nRow + 270, nCol + 200 OF oDlg Title "Table-Options" PIXEL
@ 0,0 XBROWSE oBrw OF oDlg1 columns {1, 2, 3, 4 };
Array aArray sizes {40, 25, 90 } LINES SIZE 100, 135
oBrw:nMarqueeStyle := 4
oBrw:nRowHeight := 40
oBrw:lFooter := .F.
oBrw:lHScroll := .F.
oBrw:lVScroll := .T.
oBrw:aCols[ 1 ]:cHeader = "Table"
oBrw:aCols[ 1 ]:nEditType := TYPE_IMAGE
oBrw:aCols[ 1 ]:lBmpStretch := .f.
oBrw:aCols[ 1 ]:lBmpTransparent := .t.
oBrw:aCols[ 1 ]:bStrImage := {|oCol, oBrw| oBrw:aRow[ 4 ] }
oBrw:aCols[ 1 ]:nDataBmpAlign := AL_CENTER
oBrw:aCols[ 1 ]:bAlphaLevel := { | o | o:oBrw:aRow[ 5 ] }
oBrw:aCols[ 2]:cHeader = "No"
oBrw:aCols[ 3]:cHeader = "Option"
oBrw:bLClicked := { | nRow, nCol | ( nSelect := oBrw:nRowSel, oDlg1:End() ) }
oBrw:bClrSelFocus = { || { 0, 16638387 } }
// Shows a Black Color, pressing a Window-Button !!!
oBrw:bClrSelect = { || { 0, 16638387 } }oBrw:SetBackGround( "Marble.bmp" )
oDlg1:oClient := oBrw
oBrw:CreateFromCode()
oBrw:SetFont( oBrwFont )
ACTIVATE DIALOG oDlg1
RETURN NIL
I think, setting the Focus to the Row of the Table-Selection ( not on Top at Start ) will be better.
Would be Row Number 4 at Start in this Situation.
ShowPopUp( oDlg, oBmp[11]:nTop + 100, oBmp[11]:nLeft + 70, "ROUND",
nMENPOS[11] )
// ----------------
FUNCTION ShowPopup( oDlg, nRow, nCol, cStyle,
nMenPos )
LOCAL oDlg1, oBrw, aArray:={}, oBrwFont
oBrwFont := TFont():New("Arial", ,-14,.F.,.T. , , , ,.T. )
..
oBrw:nArrayAt := nMenPos
oBrw:nRowSel := nMenPos..
oBrw:SetFont( oBrwFont )
ACTIVATE DIALOG oDlg1
oBrwFont:End()
RETURN NIL
A Table-Position ( Table 11 ) on Bottom of the Drawing-Area, will adjust the Top of the Popup-Menu
to a higher Screen-position in Relation to the Table, to show the full Menu-Size.
IF nRow > 450
DEFINE DIALOG oDlg1 FROM nRow - 70, nCol TO nRow + 200, nCol + 220 OF oDlg Title "Table-Options" PIXEL
ELSE
DEFINE DIALOG oDlg1 FROM nRow, nCol TO nRow + 270, nCol + 220 OF oDlg Title "Table-Options" PIXEL
ENDIF
@ 0,0 XBROWSE oBrw OF oDlg1 columns {1, 2, 3, 4 };
Array aArray sizes {45, 30, 110 } LINES SIZE 110, 140 Best Regards
Uwe