Page 1 of 1

menu popup at...

Posted: Wed Mar 05, 2008 9:31 am
by Silvio
I want to show a popup menu
I made :

Code: Select all


 oApp():oGrid:bLDblClick :={|| Disp_Men(oApp():oDlg,90,240)}
....

STAT FUNC Disp_Men(oDlg,nRow,nCol)
   LOCAL oMenu
   MENU oMenu POPUP 2007
   MENUITEM "&Dati Generali  "
 ENDMENU
   ACTIVATE POPUP oMenu OF oApp:oDlg AT nRow,nCol
RETURN (NIL)
How I can Make to show this menu on the coordinates where I doubleclick with the mouse ...and not on 90,240 ?

Popup on Mouse Cors.

Posted: Wed Mar 05, 2008 10:28 am
by ukoenig
Hello Silvio

here is the code you need for a popup on mouse cors.

Code: Select all


// don't forget !!!

FUNCTION MAIN()
LOCAL oWnd, hDC   ............

DEFINE WINDOW oWnd FROM 0, 0 TO 24, 80 
.....
.....
.....
......

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON CLICK SHOWPOPUP(oWnd,nRow,nCOL,hDC,oBrush) 


//--   Your menue with Button-Bitmaps --------------//

function SHOWPOPUP(oWnd,nRow,nCOL,hDC,oBrush)

local oMenu1

MENU oMenu1  POPUP
   MENUITEM RESOURCE "P_STAMM"
   MENU
      MENUITEM RESOURCE "Kunden" MESSAGE " ..... " ;
      ACTION ( CURSORWAIT(), Patient(), SYSREFRESH() )
      SEPARATOR
      MENUITEM RESOURCE "Arzt" MESSAGE "....." ;
      ACTION ( CURSORWAIT(), Arzt(), SYSREFRESH() )
      SEPARATOR
      MENUITEM RESOURCE "Kassen" MESSAGE "....." ;
      ACTION ( CURSORWAIT(), Kassen(), SYSREFRESH() )
      SEPARATOR
      MENUITEM RESOURCE "Mitarb" MESSAGE "...." ;
      ACTION ( CURSORWAIT(), Mitarbeit1(), SYSREFRESH() )
......
......

ENDMENU

ACTIVATE POPUP oMenu1 AT nRow, nCol OF oWnd

RETURN( NIL )

Regards
Uwe
[/code]

Posted: Wed Mar 05, 2008 11:19 am
by Silvio
SORRY,
BUT PERHAPS YOU NOT UNDERSTAND THE QUESTION !!!!!!!!!!


on your code there 's not nrow and ncol variables !!

Popup-Position nRow, nCol

Posted: Wed Mar 05, 2008 12:12 pm
by ukoenig
Hello Silvio,

nRow and nCol are not defined, because they come from
the MouseClick-Position inside of a Window or Dialog
where to open the Popup.

Image

Regards
Uwe :lol: [/img]

Posted: Thu Mar 06, 2008 12:39 pm
by Silvio
I not must show a popup into a dialog
BUT I must show a popup into grid ( xbrowse) when I click a record



if not set nrow and ncol

it make error
see here :
--------------------------------------------------------------

Application
===========
Path and name: C:\work\prg\VDSWIN\VdsWin.Exe (32 bits)
Size: 2,620,928 bytes
Time from start: 0 hours 0 mins 3 secs
Error occurred at: 06/03/2008, 13:46:07
Error description: Error BASE/1003 Variable does not exist: NROW

Stack Calls
===========
Called from: ASS510.prg => (b)CAW510(199)
Called from: WINDOW.PRG => TCONTROL:LDBLCLICK(0)
Called from: XBROWSE.PRG => TXBROWSE:LDBLCLICK(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: CONTROL.PRG => TXBROWSE:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TWINDOW:ACTIVATE(0)
Called from: main.prg => TAPPLICATION:ACTIVATE(267)
Called from: main.prg => MAIN(55)
--------------------------------------------------------------



I found now the solution !!!!
oApp():oGrid:bLDblClick :={|| Disp_Men(oApp():oDlg,90,240)}
ACTIVATE POPUP oMenu OF oDlg AT oBrw:nTop+nRow, oBrw:nLeft+nCol+4

bt it not is the good solution

Popup in xBrowse

Posted: Thu Mar 06, 2008 1:25 pm
by ukoenig
Hello Silvio

I'm just busy, to do a nice xBrowse-sample.
( based of a sample from Mr. Linares )
Today, it will be in the forum.
There will some nice buttons as well
for download.

Regards
Uwe

Popup with Bitmaps in xBrowse

Posted: Thu Mar 06, 2008 5:04 pm
by ukoenig
Hello Silvio
Here is the promised source

Image

Button download : http://www.pflegeplus.com/pictures/buttons1.zip

Code: Select all


// Popup with Bitmaps in xBrowse

oBrw := TXBrowse():New( oDlg )

oBrw:nMarqueeStyle		:= MARQSTYLE_HIGHLROW
oBrw:nColDividerStyle		:= LINESTYLE_BLACK
oBrw:nRowDividerStyle	:= LINESTYLE_BLACK
oBrw:lColDividerComplete	:= .t.
oBrw:nHeaderLines		:= 1
oBrw:nDataLines			:= 1
oBrw:lAllowColSwapping      := .t.
oBrw:SetRDD()

...........
........... 
// cAlias1 = Alias of your Database
// cAlias2 = possible, to copy to database 2 with same fields
// otherwise cAlias2 = cAlias1

oBrw:bRClicked := {|nRow,nCol| BRPopup( nRow,nCol,oBrw,cAlias1,cAlias1) }    // = Poppup
	
...........
...........

oBrw:CreateFromResource( 110 )

..........

RETURN( NIL )

// ---------   Use your own NET-Functions ----------------------

FUNCTION BRPopup(nRow,nCol,oBrw,cAlias1,cAlias2)
LOCAL oMenu 

MENU oMenu POPUP 
        // New
	MENUITEM RESOURCE "BUTT_1" ACTION NET_APPEND() 
        // Delete
	MENUITEM RESOURCE "BUTT_2" ACTION IIF( (cAlias1)->(DELETED()), NIL, NET_DELETE() )  
        // Recall
	MENUITEM RESOURCE "BUTT_3" ACTION NET_RECALL() 
        // Copy
	// cAlias1 = Alias of your database,   cAlias2 = mabe copy to another Database
	// otherwise same database  => cAlias2 = cAlias1
        MENUITEM RESOURCE "BUTT_4" ACTION NET_COPY(cAlias1,cAlias1)  
ENDMENU 

oBrw:Refresh()

ACTIVATE POPUP oMenu WINDOW oBrw AT nRow, nCol 

RETURN( NIL )

//----------- Record-Copy ---------------------------------------------//

FUNCTION NET_COPY ( cArea1, cArea2 )
LOCAL FX, DATEN := {}, RECNO := RECNO()

// Possible to copy to another database
// otherwise nArea1 = nArea2

lReturn := .T.

DBSELECTAREA(cArea1)
FOR FX := 1 TO FCOUNT()      // Fields --> Arrray
	AADD(DATEN, FIELDGET(FX))
NEXT

DBSELECTAREA(cArea2)
IF NET_APPEND()
     RECNO := RECNO()
ELSE
     lReturn := .F.
ENDIF

IF lReturn = .T.
	DBSELECTAREA(cArea2)
	NET_RLOCK()
	FOR FX := 1 TO FCOUNT()      // Array --> Fields
		FIELDPUT(FX, DATEN[FX])
	NEXT
	NET_ULOCK()
ELSE
	MsgAlert ( "Copy of Record not possible !!!", "ATTENTION !")
ENDIF

DBSELECTAREA(cArea1)
GOTO RECNO

RETURN lReturn

Regards
Uwe :lol: [/img][/code]