set a dialog on a position

set a dialog on a position

Postby Silvio.Falconi » Tue Apr 27, 2021 11:22 am

I wish set a dialog at x,y but I not found the position of the msgitem og Msgbar

oApp:oMsgItem1:bAction := { |oBtn| ::ConteggioTotali(oApp:oWndMain:oMsgBar) }

Function ConteggioTotali(obtn)
Local aPoint := AdjustWnd( oBtn, -27*2, 15*2 )

DEFINE DIALOG oDlgConteggio size 400,250 TRANSPARENT;
TITLE "Conteggio elementi"

ACTIVATE DIALOG oDlgConteggio CENTERED;
ON CLICK oDlgConteggio:End() ;
ON PAINT oDlgConteggio:Move(aPoint[1]-100, aPoint[2],,,.t.);

give me allway under the main window
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: set a dialog on a position

Postby nageswaragunupudi » Tue Apr 27, 2021 2:12 pm

Try this sample and adapt the logic to your program
Code: Select all  Expand view  RUN
#include "fivewin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oWnd, oBar, oMsgBar, oMsgItemDlg, oMsgItemPop

   DEFINE WINDOW oWnd
   DEFINE BUTTONBAR OF oWnd 2007

   DEFINE MSGBAR oMsgBar OF oWnd 2007
   DEFINE MSGITEM oMsgItemDlg PROMPT "ShowDialog" OF oMsgBar SIZE 100 ;
         ACTION ShowDlg( oMsgItemDlg )
   DEFINE MSGITEM oMsgItemPop PROMPT "Show Popup" OF oMsgBar SIZE 100 ;
         ACTION ShowPopup( oMsgItemPop )
   DEFINE MSGITEM PROMPT "Dummy Item" OF oMsgBar SIZE 100
   DEFINE MSGITEM PROMPT "Dummy Item" OF oMsgBar SIZE 100

   oWnd:nHeight   := 500
   oWnd:nWidth    := 700

   ACTIVATE WINDOW oWnd CENTERED

return nil

//----------------------------------------------------------------------------//

static function ShowPopup( oMsgItem )

   local oPop

   MENU oPop POPUP 2007
      MENUITEM "One"
      MENUITEM "Two"
      MENUITEM "Three"
   ENDMENU

   ACTIVATE MENU oPop AT oMsgItem:oMsgBar:nTop, oMsgItem:nLeft OF oMsgItem:oMsgBar:oWnd FLAGS 0x20

return nil

//----------------------------------------------------------------------------//

static function ShowDlg( oMsgItem )

   local oDlg
   local oMsgBar  := oMsgItem:oMsgBar
   local oWnd     := oMsgBar:oWnd
   local aPt      := { oMsgBar:nTop, oMsgItem:nLeft }

   aPt   := ClientToScreen( oWnd:hWnd, aPt )

   DEFINE DIALOG oDlg SIZE 100,150 PIXEL TRUEPIXEL
   ACTIVATE DIALOG oDlg ON INIT oDlg:Move( aPt[ 1 ] - oDlg:nHeight, aPt[ 2 ] )

return nil

//----------------------------------------------------------------------------//
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: set a dialog on a position

Postby nageswaragunupudi » Tue Apr 27, 2021 2:12 pm

Try this sample and adapt the logic to your program
Code: Select all  Expand view  RUN
#include "fivewin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oWnd, oBar, oMsgBar, oMsgItemDlg, oMsgItemPop

   DEFINE WINDOW oWnd
   DEFINE BUTTONBAR OF oWnd 2007

   DEFINE MSGBAR oMsgBar OF oWnd 2007
   DEFINE MSGITEM oMsgItemDlg PROMPT "ShowDialog" OF oMsgBar SIZE 100 ;
         ACTION ShowDlg( oMsgItemDlg )
   DEFINE MSGITEM oMsgItemPop PROMPT "Show Popup" OF oMsgBar SIZE 100 ;
         ACTION ShowPopup( oMsgItemPop )
   DEFINE MSGITEM PROMPT "Dummy Item" OF oMsgBar SIZE 100
   DEFINE MSGITEM PROMPT "Dummy Item" OF oMsgBar SIZE 100

   oWnd:nHeight   := 500
   oWnd:nWidth    := 700

   ACTIVATE WINDOW oWnd CENTERED

return nil

//----------------------------------------------------------------------------//

static function ShowPopup( oMsgItem )

   local oPop

   MENU oPop POPUP 2007
      MENUITEM "One"
      MENUITEM "Two"
      MENUITEM "Three"
   ENDMENU

   ACTIVATE MENU oPop AT oMsgItem:oMsgBar:nTop, oMsgItem:nLeft OF oMsgItem:oMsgBar:oWnd FLAGS 0x20

return nil

//----------------------------------------------------------------------------//

static function ShowDlg( oMsgItem )

   local oDlg
   local oMsgBar  := oMsgItem:oMsgBar
   local oWnd     := oMsgBar:oWnd
   local aPt      := { oMsgBar:nTop, oMsgItem:nLeft }

   aPt   := ClientToScreen( oWnd:hWnd, aPt )

   DEFINE DIALOG oDlg SIZE 100,150 PIXEL TRUEPIXEL
   ACTIVATE DIALOG oDlg ON INIT oDlg:Move( aPt[ 1 ] - oDlg:nHeight, aPt[ 2 ] )

return nil

//----------------------------------------------------------------------------//
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: set a dialog on a position

Postby Silvio.Falconi » Wed Apr 28, 2021 6:16 am

that's just what I was looking for. thank's my friend
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 79 guests