FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour BtnBmp and PopupMenu
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

BtnBmp and PopupMenu

Posted: Thu Jun 21, 2018 01:34 PM
I wish Open a PopupMenu on Btnbmp I tried with

:bRClicked := { | nRow, nCol, oBtn | ShowActions( nRow, nCol,n, oBtn ) }

and

:bAction := { | nRow, nCol, oBtn | ShowActions( nRow, nCol,n, oBtn ) }

But it make error

Code (fw): Select all Collapse
  for n := 1 to 70
      @ nRow, nCol BTNBMP aBtn[ n ] .....
 WITH OBJECT aBtn[ n ]
         :Cargo      := n
:bRClicked := { | nRow, nCol, oBtn | ShowActions( nRow, nCol,n, oBtn ) }

 END
.....
Function ShowActions( nrow, ncol, n, oControl )
   Local oMenuPopup
   MENU POPUP oMenuPopup
  MenuItem "aaaaaaaaaaaa"
  MenuItem "bbbbbbbbbbbbb"
    ENDMENU
 ACTIVATE POPUP oMenuPopup  of oControl AT nrow, ncol
Return NIL


Any solution Please
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: 6755
Joined: Wed Feb 15, 2012 08:25 PM

Re: BtnBmp and PopupMenu

Posted: Thu Jun 21, 2018 02:17 PM

What error ?

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: BtnBmp and PopupMenu

Posted: Thu Jun 21, 2018 02:27 PM
with baction I not see the menupopup
with :bRClicked I Have this error
Code (fw): Select all Collapse
Application
===========
   Path and name: C:\Work\Errori\image_su_btnbmp\test.Exe (32 bits)
   Size: 3,655,168 bytes
   Compiler version: Harbour 3.2.0dev (r1703231115)
   FiveWin  version: FWH 17.12
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.2, Build 9200 

   Time from start: 0 hours 0 mins 3 secs 
   Error occurred at: 21-06-2018, 16:26:13
   Error description: Error BASE/1004  No exported method: HWND
   Args:
     [   1] = N   2

Stack Calls
===========
   Called from:  => HWND( 0 )
   Called from: .\source\classes\MENU.PRG => TMENU:ACTIVATE( 1568 )
   Called from: test.prg => SHOWACTIONS( 121 )
   Called from: test.prg => (b)SHOW_BEACH( 66 )
   Called from: .\source\classes\WINDOW.PRG => TBTNBMP:RBUTTONDOWN( 2018 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1731 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1883 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3356 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG
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: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: BtnBmp and PopupMenu

Posted: Thu Jun 21, 2018 03:18 PM
Now I tried with

Code (fw): Select all Collapse
  for n := 1 to 10
      @ nRow, nCol BTNBMP aBtn[ n ]  RESOURCE OMB_LIBERO  ;
         SIZE 84,64 PIXEL OF oDlg FLAT TOP COLOR CLR_WHITE,CLR_GREEN NOBORDER 

WITH OBJECT aBtn[ n ]
         :Cargo      := n 
         :bRClicked    := { | nRow, nCol, oBtn | EseguiButton(nrow, ncol, n, oBtn) }
 END
 next n

FUNCTION EseguiButton( nrow, ncol, n, oControl )
RETURN { |n| Menu_popup( nrow, ncol, n, oControl )  }

FUNCTION Menu_Popup( nrow, ncol, n, oControl )
Local oMenuPop
  MENU oMenuPop POPUP 2015
   MENUITEM "Apri "
    MENUITEM "Apri "

 ACTIVATE POPUP oMenuPop OF oControl AT nrow, ncol
 oControl:Refresh()
 RETURN NIL


but not make error and not show the menu popup
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: 6755
Joined: Wed Feb 15, 2012 08:25 PM

Re: BtnBmp and PopupMenu

Posted: Thu Jun 21, 2018 05:42 PM

Please, search for "detached locals technicque", in forum
It is very possible that this is the problem

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: BtnBmp and PopupMenu

Posted: Fri Jun 22, 2018 11:02 AM

???????

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: BtnBmp and PopupMenu

Posted: Fri Jun 22, 2018 01:17 PM
First please implement a small fix in btnbmp.prg.
Locate the following lines in the method ShowPopUp()
Code (fw): Select all Collapse
      if GetClassName( GetParent( Self:hWnd ) ) != "TBAR"
         oWnd = oWndFromhWnd( GetParent( Self:hWnd ) )
      endif

Comment out all the 3 lines above.

Next, please try this program:
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oDlg, oFont, aBtn[ 5 ]
   local aBmp := { "attach.bmp", "browse.bmp", "calc.bmp", "cascade.bmp", "copy.bmp" }
   local n, nRow, nCol

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL FONT oFont

   nRow  :=  40
   nCol  :=  40

   for n := 1 to 5
      @ nRow, nCol BTNBMP aBtn[ n ] FILE "c:\fwh\bitmaps\32x32\" + aBmp[ n ] ;
         PROMPT NtoCMonth( n ) ;
         SIZE 100,100 PIXEL OF oDlg TOP FLAT COLOR CLR_WHITE,CLR_GREEN NOBORDER ACTION ::ShowPopup()

      aBtn[ n ]:Cargo   := n
      aBtn[ n ]:oPopUp  := { |oBtn| BtnPopMenu( oBtn ) }

      nCol  += 120
   next

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

function BtnPopMenu( oBtn )

   local oPop
   local n

   MENU oPop POPUP 2007
   for n := oBtn:Cargo + 1 to 12
      MENUITEM NToCMonth( n )
   next
   ENDMENU

return oPop


Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: BtnBmp and PopupMenu

Posted: Sat Jun 23, 2018 09:53 AM

Thank
can we erase or not show the part where is the black Arrow ?

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: BtnBmp and PopupMenu

Posted: Sat Jun 23, 2018 11:50 AM
Please make this modification
Code (fw): Select all Collapse
   for n := 1 to 5
      @ nRow, nCol BTNBMP aBtn[ n ] FILE "c:\fwh\bitmaps\32x32\" + aBmp[ n ] ;
         PROMPT NtoCMonth( n ) ;
         SIZE 100,100 PIXEL OF oDlg TOP FLAT COLOR CLR_WHITE,CLR_GREEN NOBORDER ; // ACTION ::ShowPopup()
         ACTION ( ::oPopup := { |oBtn| BtnPopMenu( oBtn ) }, ;
                  ::ShowPopUp(), ;
                  ::oPopup := nil )

      aBtn[ n ]:Cargo   := n
//      aBtn[ n ]:oPopUp  := { |oBtn| BtnPopMenu( oBtn ) }

      nCol  += 120
   next
Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: BtnBmp and PopupMenu

Posted: Sat Jun 23, 2018 03:34 PM
then when It show the menu it create the part with black arrow
on oldest release of my prg it not is showed
when I click on btnbmp it open a popupmenu near the btnbmp and I not see the part with black arrow
for my advice the black arrow can be usefull ony on a tbar control

for now I resolved with rem on METHOD PaintPopupSection()
on future we can apologize a logic variable to show or not the popupsection when the btnbmp is not on tbar





We suggest

if ::oPopup != nil .and. GetClassName( GetParent( Self:hWnd ) ) = "TBAR"
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