MENUITEM with BLOCK command executed TWICE. (SOLVED)

User avatar
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: MENUITEM with BLOCK command executed TWICE.

Post by cnavarro »

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
Horizon
Posts: 1329
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 6 times
Been thanked: 1 time

Re: MENUITEM with BLOCK command executed TWICE.

Post by Horizon »

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
User avatar
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: MENUITEM with BLOCK command executed TWICE.

Post by cnavarro »

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
Silvio.Falconi
Posts: 7170
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 5 times

Re: MENUITEM with BLOCK command executed TWICE.

Post by Silvio.Falconi »

this run ok ( with your funcs)

Code: Select all | Expand

 


  #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


#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 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
Horizon
Posts: 1329
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 6 times
Been thanked: 1 time

Re: MENUITEM with BLOCK command executed TWICE.

Post by Horizon »

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: 1329
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 6 times
Been thanked: 1 time

Re: MENUITEM with BLOCK command executed TWICE.

Post by Horizon »

Any solution?
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
User avatar
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: MENUITEM with BLOCK command executed TWICE.

Post by cnavarro »

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
Horizon
Posts: 1329
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 6 times
Been thanked: 1 time

Re: MENUITEM with BLOCK command executed TWICE.

Post by Horizon »

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
User avatar
Antonio Linares
Site Admin
Posts: 42604
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 44 times
Been thanked: 88 times
Contact:

Re: MENUITEM with BLOCK command executed TWICE.

Post by Antonio Linares »

Dear Hakan,

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

many thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
Horizon
Posts: 1329
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 6 times
Been thanked: 1 time

Re: MENUITEM with BLOCK command executed TWICE.

Post by Horizon »

Hi,

Code: Select all | Expand


#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
User avatar
karinha
Posts: 7951
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: MENUITEM with BLOCK command executed TWICE.

Post by karinha »

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

Code: Select all | Expand


#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
Horizon
Posts: 1329
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 6 times
Been thanked: 1 time

Re: MENUITEM with BLOCK command executed TWICE.

Post by Horizon »

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

Code: Select all | Expand


#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
User avatar
karinha
Posts: 7951
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: MENUITEM with BLOCK command executed TWICE.

Post by karinha »

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

Code: Select all | Expand


#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
Horizon
Posts: 1329
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 6 times
Been thanked: 1 time

Re: MENUITEM with BLOCK command executed TWICE.

Post by Horizon »

Horizon wrote:Hi,

Code: Select all | Expand


#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
User avatar
Antonio Linares
Site Admin
Posts: 42604
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 44 times
Been thanked: 88 times
Contact:

Re: MENUITEM with BLOCK command executed TWICE.

Post by Antonio Linares »

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
Post Reply