Hi Roger,
I need to create a function that opens a rectangle overwriting the row of a selected browse, when i press ENTER o double click, like that:
in this way I can manage the record information well without having to use the standard cell editor that you have provided in the dcbrowse
for example:
@ x,y DCBROWSE oBrowse SIZE 100,25 ID "BROWSE" ;
CURSORMODE XBPBRW_CURSOR_ROW ALIAS cAlias ;
DATALINK {|a,oGet|MY_FUNCTION(oGet)}
static function MY_FUNCTION (oGet)
LOCAL GetOptions,GetList:={}
LOCAL nRow,nCol
nRow := * how i can retreive the row position of the browse ?
// field#1
field_1:=cAlias->FIELD1
nCol:= * how i can retreive the #1 column position of the browse ?
@ nRow,nCol DCGET field_1
// field#2
field_2:=cAlias->FIELD2
nCol:= * how i can retreive the #2 column position of the browse ?
@ nRow,nCol DCGET field_2
..
..
DCGETOPTIONS CONFIRM NOTITLE NORESIZE NOTASKLIST HIDE
DCREAD GUI OPTIONS GetOptions FIT MODAL ..... EVAL {|o| <positioning_at_browse_row_and_column> }
REPLACE ....
return nil
DCBROWSE with custom row editor
Re: DCBROWSE with custom row editor
You may want to look at \exp20\samples\celledit\celledit.prg
This will give you a starting point.
It does not use the built-in cell-editing system, but instead gives you the control you would want.
This will give you a starting point.
It does not use the built-in cell-editing system, but instead gives you the control you would want.
The eXpress train is coming - and it has more cars.
Re: DCBROWSE with custom row editor
nRowPos := oBrowse:rowPos // number of row selected when i double click or press enter in the browse
// coordinates of #1 cell of browse
oColumn := oBrowse:getColumn( 1 )
oCell := oColumn:dataArea
aRect := oCell:CellRect( nRowPos ) // aRect[4]-aRect[2] is the HEIGHT of the row
I don't know how to calculate the x,y coordinates to place my edit area (blue rectangle) upper the selected row of the browse
Re: DCBROWSE with custom row editor
I keep looking at your question and don't know how to answer it, other than writing a bunch of code for you.
I had hoped that you would be able to figure this out from the sample I referred to you.
If I had more time, I would help you, but I am inundated with work at the moment.
I had hoped that you would be able to figure this out from the sample I referred to you.
If I had more time, I would help you, but I am inundated with work at the moment.
The eXpress train is coming - and it has more cars.
-
- Posts: 484
- Joined: Wed Jan 27, 2010 10:25 pm
- Location: Berlin Germany
Re: DCBROWSE with custom row editor
I do the calculation in my DCBrowse to open the context menu (oPopupMenu) at the Mouse position as follows:
Perhaps you can adopt that to your needs.
Code: Select all
DCBROWSE .....
EVAL {|o| o:ItemRbDown := {|aMPos, aLC, oBr| DC_GetRefresh(oPopupMenu), ActRbMenu(aMPos, aLC, oBr, oPopupMenu)}}
...
Function ActRbMenu(aMPos, aLC, oBr, oRightMenu)
LOCAL nRight := aLC[2] - oBr:ColPos
LOCAL nDown := aLC[1] - oBr:RowPos
LOCAL nLeft := 0, nUp := 0, i := 0
if nRight < 0
nLeft := nRight * -1
endif
if nDown < 0
nUp := nDown * -1
endif
for i := 1 to nUp
oBr:Up()
next
for i := 1 to nDown
oBr:Down()
next
for i := 1 to nRight
oBr:Right()
next
for i := 1 to nLeft
oBr:Left()
next
oBr:RefreshAll()
oRightMenu:PopUp(oBr, aMPos)
return (NIL)
_______________________
Best Regards
Wolfgang
Best Regards
Wolfgang
Re: DCBROWSE with custom row editor
now I'm using a formula that assumes that the height of the header of the browse is equal to that of the row, eg.:
aSize:=oBrowse:currentSize()
aPos:=oBrowse:currentPos()
nColPos := oBrowse:colPos
nRowPos := oBrowse:rowPos
oFirstColumn := oBrowse:getColumn( 1 ) // #column1
oFirstCell := oFirstColumn:dataArea
aFirstRect := oFirstCell:CellRect( nRowPos )
nRowHeight:=aFirstRect[4]-aFirstRect[2]
ROW_Y_POS := nRowHeight*nRowPos
but, how do you calculate the height of the head of the browse, correctly ?
aSize:=oBrowse:currentSize()
aPos:=oBrowse:currentPos()
nColPos := oBrowse:colPos
nRowPos := oBrowse:rowPos
oFirstColumn := oBrowse:getColumn( 1 ) // #column1
oFirstCell := oFirstColumn:dataArea
aFirstRect := oFirstCell:CellRect( nRowPos )
nRowHeight:=aFirstRect[4]-aFirstRect[2]
ROW_Y_POS := nRowHeight*nRowPos
but, how do you calculate the height of the head of the browse, correctly ?
Re: DCBROWSE with custom row editor
oColumn:heading:currentSize()[2]
The eXpress train is coming - and it has more cars.