FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour set a dialog on a position
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
set a dialog on a position
Posted: 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, -272, 152 )

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 March-April 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: set a dialog on a position
Posted: Tue Apr 27, 2021 02:12 PM
Try this sample and adapt the logic to your program
Code (fw): Select all Collapse
#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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: set a dialog on a position
Posted: Tue Apr 27, 2021 02:12 PM
Try this sample and adapt the logic to your program
Code (fw): Select all Collapse
#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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: set a dialog on a position
Posted: Wed Apr 28, 2021 06: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 March-April 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

Continue the discussion