MENUITEM with BLOCK command executed TWICE. (SOLVED)

Re: MENUITEM with BLOCK command executed TWICE.

Postby cnavarro » Tue May 11, 2021 5:01 pm

I deleted previous link
Please try this and rename to .exe
https://bitbucket.org/fivetech/fivewin- ... rizon2.ex1
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
User avatar
cnavarro
 
Posts: 6544
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: MENUITEM with BLOCK command executed TWICE.

Postby Horizon » Tue May 11, 2021 5:18 pm

cnavarro wrote:I deleted previous link
Please try this and rename to .exe
https://bitbucket.org/fivetech/fivewin- ... rizon2.ex1


Hi Mr. Navarro,

It is not related to filename. I could not download any file in https://bitbucket.org/fivetech/fivewin-contributions/downloads/
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: MENUITEM with BLOCK command executed TWICE.

Postby cnavarro » Tue May 11, 2021 7:05 pm

Dear Hakan, why?
Please send me a mail to navarro [ dot ] cristobal [ arroba ] gmail [ dot ] com
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
User avatar
cnavarro
 
Posts: 6544
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: MENUITEM with BLOCK command executed TWICE.

Postby Silvio.Falconi » Tue May 11, 2021 8:02 pm

this run ok ( with your funcs)

Code: Select all  Expand view
 


  #include "FiveWin.ch"

    function Main()

       local oWnd

       DEFINE WINDOW oWnd MENU BuildMenu()

       ACTIVATE WINDOW oWnd

    return nil


//---------------------------------------------------------------------------------------------------------//
    function BuildMenu()

       local oMenu,nhh,baction

       MENU oMenu
          MENUITEM "First"
             MENU
                For nhh= 1 to 4
                 baction:= GenBlock_Faiz(nhh)
                MENUITEM "function number "+ltrim(str(nhh)) BLOCK baction
               next
             ENDMENU  
       ENDMENU

    return oMenu



//---------------------------------------------------------------------------------------------------------//
      FUNCTION GenBlock_Faiz(nhh)
    LOCAL cProc := "Faiz"+ALLTRIM(STR(nhh))
    RETURN {|| &(cProc)() }
//---------------------------------------------------------------------------------------------------------//
 Function Faiz4()
      return  Msginfo("run 4")

Function Faiz3()
      return  Msginfo("run  3")

Function Faiz2()
      return  Msginfo("run 2")

Function Faiz1()
      return  Msginfo("run 1")
   





On the other hand, if you want to make a popup menu on a window then it just doesn't work

Code: Select all  Expand view

#include "FiveWin.ch"

    function Main()

       local oWnd

       DEFINE WINDOW oWnd MENU BuildMenu()

       ACTIVATE WINDOW oWnd ;
        ON CLICK ShowPopup( nRow, nCol,oWnd )

    return nil

function ShowPopup( nRow, nCol,oWnd)
   local  oPop

   MENU oPop POPUP

          MENUITEM "Menu popup "
             MENU
                For nhh= 1 to 4
                 baction:= GenBlock_Faiz(nhh)
                MENUITEM "function number "+ltrim(str(nhh)) BLOCK baction
               next
             ENDMENU
       ENDMENU

   ACTIVATE POPUP oPop AT nRow, nCol OF oWnd

return nil

//---------------------------------------------------------------------------------------------------------//
      FUNCTION GenBlock_Faiz(nhh)
    LOCAL cProc := "Faiz"+ALLTRIM(STR(nhh))
    RETURN {|| &(cProc)() }
//---------------------------------------------------------------------------------------------------------//
 Function Faiz4()
      return  Msginfo("run 4")

Function Faiz3()
      return  Msginfo("run  3")

Function Faiz2()
      return  Msginfo("run 2")

Function Faiz1()
   return  Msginfo("run 1")



I would also be interested in solving the problem. thank you
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: 7059
Joined: Thu Oct 18, 2012 7:17 pm

Re: MENUITEM with BLOCK command executed TWICE.

Postby Horizon » Wed May 12, 2021 8:41 am

cnavarro wrote:Dear Hakan, why?
Please send me a mail to navarro [ dot ] cristobal [ arroba ] gmail [ dot ] com


Sent.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: MENUITEM with BLOCK command executed TWICE.

Postby Horizon » Thu May 13, 2021 7:33 am

Any solution?
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: MENUITEM with BLOCK command executed TWICE.

Postby cnavarro » Thu May 13, 2021 7:59 am

Hakan, your mail It was in the span folder and I hadn't seen it
I am seeing how I can send the executable to you
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
User avatar
cnavarro
 
Posts: 6544
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: MENUITEM with BLOCK command executed TWICE.

Postby Horizon » Thu May 13, 2021 10:52 am

cnavarro wrote:Hakan, your mail It was in the span folder and I hadn't seen it
I am seeing how I can send the executable to you


Hi Mr. Navarro,

I have downloaded and run. Ribbon does not properly work. There is no option Change Style. Menu First works once "run4".

I really dont know where to look.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: MENUITEM with BLOCK command executed TWICE.

Postby Antonio Linares » Thu May 13, 2021 10:56 am

Dear Hakan,

Could you provide a small and self contained PRG to test here ?

many thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: MENUITEM with BLOCK command executed TWICE.

Postby Horizon » Thu May 13, 2021 11:37 am

Hi,

Code: Select all  Expand view

#include "fivewin.ch"
#include "ribbon.ch"


function main()

   local oRBar
   local oWnd, oMenu

   DEFINE WINDOW oWnd TITLE "RibbonBar Test " + FWVERSION from 1,1 to 600,600 pixel //brush oBrush1
   
   Define_RIBBON(oWnd)

  SET MESSAGE OF oWnd TO "Testing FWH own Class RibbonBar" ;
      CENTERED CLOCK KEYBOARD 2007
   
   ACTIVATE WINDOW oWnd MAXIMIZED
   
   oRBar:End()
   
return nil

PROCEDURE Define_RIBBON(oWnd)
LOCAL oFaizMenu, oTopluRap, oYetkiVerme
LOCAL oRBar, oGrp11
 
    MENU oFaizMenu POPUP 2007
        MENUITEM "test" BLOCK { || MsgInfo( "Hello" ) }        
    ENDMENU
     
    DEFINE RIBBONBAR oRBar WINDOW oWnd ;
        PROMPT "Option 1","Option 2","Option 3" ;
        HEIGHT 133 TOPMARGIN 25
    oRBar:nLeftMargin := 75
    oRBar:CalcPos()
   
  ADD GROUP oGrp11  RIBBON oRBar TO OPTION 1 PROMPT "" WIDTH 200
        @ 3, 3 ADD BUTTON oBtn GROUP oGrp11 ;
            SIZE 70, 70 PROMPT "Faiz" ;
            MENU oFaizMenu POPUP        
 
RETURN
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: MENUITEM with BLOCK command executed TWICE.

Postby karinha » Thu May 13, 2021 12:13 pm

Hello, in this modified example, what should he do?

Code: Select all  Expand view

#Include "FiveWin.ch"
#Include "Ribbon.ch"

STATIC oWnd

FUNCTION Main()

   LOCAL oRBar
   LOCAL oMenu

   DEFINE WINDOW oWnd TITLE "RibbonBar Test " + FWVERSION
   
   // Define_RIBBON( oWnd )

   SET MESSAGE OF oWnd TO "Testing FWH own Class RibbonBar" ;
      CENTERED CLOCK KEYBOARD 2007
   
   ACTIVATE WINDOW oWnd MAXIMIZED ON INIT( Define_RIBBON( oWnd ) )
   
   oRBar:End()
   
RETURN NIL

PROCEDURE Define_RIBBON(oWnd)

   LOCAL oFaizMenu, oTopluRap, oYetkiVerme
   LOCAL oRBar, oGrp11, oBtn
 
   MENU oFaizMenu POPUP 2007

      MENUITEM "test" BLOCK { || MsgInfo( "Hello" ) }

   ENDMENU
     
   DEFINE RIBBONBAR oRBar WINDOW oWnd ;
      PROMPT "Option 1","Option 2","Option 3" ;
      HEIGHT 133 TOPMARGIN 25

   oRBar:nLeftMargin := 75
   oRBar:CalcPos()
   
   ADD GROUP oGrp11  RIBBON oRBar TO OPTION 1 PROMPT "" WIDTH 200

   @ 3, 3 ADD BUTTON oBtn GROUP oGrp11 ;
      SIZE 70, 70 PROMPT "Faiz" ;
      MENU oFaizMenu POPUP
 
RETURN( oFaizMenu )

// FIN
 


Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7822
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: MENUITEM with BLOCK command executed TWICE.

Postby Horizon » Thu May 13, 2021 12:28 pm

karinha wrote:Hello, in this modified example, what should he do?

Code: Select all  Expand view

#Include "FiveWin.ch"
#Include "Ribbon.ch"

STATIC oWnd

FUNCTION Main()

   LOCAL oRBar
   LOCAL oMenu

   DEFINE WINDOW oWnd TITLE "RibbonBar Test " + FWVERSION
   
   // Define_RIBBON( oWnd )

   SET MESSAGE OF oWnd TO "Testing FWH own Class RibbonBar" ;
      CENTERED CLOCK KEYBOARD 2007
   
   ACTIVATE WINDOW oWnd MAXIMIZED ON INIT( Define_RIBBON( oWnd ) )
   
   oRBar:End()
   
RETURN NIL

PROCEDURE Define_RIBBON(oWnd)

   LOCAL oFaizMenu, oTopluRap, oYetkiVerme
   LOCAL oRBar, oGrp11, oBtn
 
   MENU oFaizMenu POPUP 2007

      MENUITEM "test" BLOCK { || MsgInfo( "Hello" ) }

   ENDMENU
     
   DEFINE RIBBONBAR oRBar WINDOW oWnd ;
      PROMPT "Option 1","Option 2","Option 3" ;
      HEIGHT 133 TOPMARGIN 25

   oRBar:nLeftMargin := 75
   oRBar:CalcPos()
   
   ADD GROUP oGrp11  RIBBON oRBar TO OPTION 1 PROMPT "" WIDTH 200

   @ 3, 3 ADD BUTTON oBtn GROUP oGrp11 ;
      SIZE 70, 70 PROMPT "Faiz" ;
      MENU oFaizMenu POPUP
 
RETURN( oFaizMenu )

// FIN
 


Regards.


It is still same behavior. there is not change.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: MENUITEM with BLOCK command executed TWICE.

Postby karinha » Thu May 13, 2021 6:39 pm

I think, that is a defect in your version. Test this example to see what happens. Regards.

Code: Select all  Expand view

#include "FiveWin.ch"
#Include "Ribbon.ch"

STATIC oWnd

STATIC lLook := .T.

FUNCTION Main()

   LOCAL oRBar
   LOCAL oMenu

   DEFINE WINDOW oWnd TITLE "RibbonBar Test " + FWVERSION
   
   // Define_RIBBON( oWnd )

   SET MESSAGE OF oWnd TO "Testing FWH own Class RibbonBar" ;
      CENTERED CLOCK KEYBOARD 2007
   
   ACTIVATE WINDOW oWnd MAXIMIZED ON INIT( Define_RIBBON( oWnd ) )
   
   oRBar:End()
   
RETURN NIL

PROCEDURE Define_RIBBON(oWnd)

   LOCAL oFaizMenu, oTopluRap, oYetkiVerme
   LOCAL oRBar, oGrp11, oBtn
 
   MENU oFaizMenu POPUP 2007

      MENUITEM "Test Vision" BLOCK { || MsgInfo( "Hello" ), lLook := .F. } ;
         WHEN( lLook )

   ENDMENU
     
   DEFINE RIBBONBAR oRBar WINDOW oWnd ;
      PROMPT "Option 1","Option 2","Option 3" ;
      HEIGHT 133 TOPMARGIN 25

   oRBar:nLeftMargin := 75
   oRBar:CalcPos()
   
   ADD GROUP oGrp11  RIBBON oRBar TO OPTION 1 PROMPT "" WIDTH 200

   @ 3, 3 ADD BUTTON oBtn GROUP oGrp11 ;
      SIZE 70, 70 PROMPT "Faiz" ;
      MENU oFaizMenu POPUP
 
RETURN( oFaizMenu )

// FIN / END
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7822
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: MENUITEM with BLOCK command executed TWICE.

Postby Horizon » Fri May 14, 2021 7:47 am

Horizon wrote:Hi,

Code: Select all  Expand view

#include "fivewin.ch"
#include "ribbon.ch"


function main()

   local oRBar
   local oWnd, oMenu

   DEFINE WINDOW oWnd TITLE "RibbonBar Test " + FWVERSION from 1,1 to 600,600 pixel //brush oBrush1
   
   Define_RIBBON(oWnd)

  SET MESSAGE OF oWnd TO "Testing FWH own Class RibbonBar" ;
      CENTERED CLOCK KEYBOARD 2007
   
   ACTIVATE WINDOW oWnd MAXIMIZED
   
   oRBar:End()
   
return nil

PROCEDURE Define_RIBBON(oWnd)
LOCAL oFaizMenu, oTopluRap, oYetkiVerme
LOCAL oRBar, oGrp11
 
    MENU oFaizMenu POPUP 2007
        MENUITEM "test" BLOCK { || MsgInfo( "Hello" ) }        
    ENDMENU
     
    DEFINE RIBBONBAR oRBar WINDOW oWnd ;
        PROMPT "Option 1","Option 2","Option 3" ;
        HEIGHT 133 TOPMARGIN 25
    oRBar:nLeftMargin := 75
    oRBar:CalcPos()
   
  ADD GROUP oGrp11  RIBBON oRBar TO OPTION 1 PROMPT "" WIDTH 200
        @ 3, 3 ADD BUTTON oBtn GROUP oGrp11 ;
            SIZE 70, 70 PROMPT "Faiz" ;
            MENU oFaizMenu POPUP        
 
RETURN


Antonio, Mr. Navarro,

Can you comfirm the problem?
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: MENUITEM with BLOCK command executed TWICE.

Postby Antonio Linares » Fri May 14, 2021 10:19 am

Hakan,

Yes, bug confirmed. thank you

Using ACTION instead of BLOCK it does not fail

We are reviewing it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 55 guests