Menu.... ha habilitado....

Postby Marco A. Delgado » Thu Jan 19, 2006 4:45 pm

Gracias Antonio

lo implemente y funciona con unos arreglos:

Code: Select all  Expand view
    ACTIVATE POPUP oMenu AT aPos[1] + 30 , aPos[2] -10 OF oBtn:oWnd:oWnd


pero aun tengo mis dudas ya que si ves esta imagenes veras las diferencias.

[/img]Image[img]

[/img]Image[/img]

ahorita tengo esto en el codigo:

Code: Select all  Expand view
            DEFINE BUTTON oBtn[2] OF oBar ;
                       RESOURCE "PRINTER"     ;
                       ACTION MenuPop(oBtn[2]);
                       FONT oWndPrinc:oFont   ;
                       MESSAGE " Reportes del Sistema" ;
                       NOBORDER            ;
                       GROUP


que corresponde a la primera figura, pero lo pongo asi.

Code: Select all  Expand view
                DEFINE BUTTON oBtn[2] OF oBar ;
                       RESOURCE "PRINTER"     ;
                       MENU MenuPop(oBtn[2])  ;
                       ACTION MenuPop(oBtn[2]);
                       FONT oWndPrinc:oFont   ;
                       MESSAGE " Reportes del Sistema" ;
                       NOBORDER            ;
                       GROUP



que deberia de ser asi, para que quede como la 2a. figura, me sale este error.

Code: Select all  Expand view
Application
===========
   Path and name: C:\PruebaMenus\Menus.Exe (32 bits)
   Size:   786,944 bytes
   Time from start: 0 hours 0 mins 0 secs
   Error occurred at: 19/01/2006, 10:24:12
   Error description: Error BASE/1004  Class: 'NIL' has no exported method: HWND
   Args:

Stack Calls
===========
   Called from:  => HWND(0)
   Called from:  => MENUPOP(102)
   Called from: menus.prg => MAIN(57)


Haciendo lo que me mencionaste en el post anterior, porque sera Antonio.

Saludos

Marco A. Delgado.
User avatar
Marco A. Delgado
 
Posts: 126
Joined: Fri Oct 07, 2005 4:20 pm
Location: Veracruz, México

Postby Antonio Linares » Thu Jan 19, 2006 8:22 pm

Marco,

Si usas la claúsula ... MENU ... en la definición del botón, entonces tu no tienes que activar el POPUP ya que FWH lo hace automaticamente.

Revisa el ejemplo samples\TestBtn.prg y observa como se crea el menú y se le dá al botón.
regards, saludos

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

Postby Marco A. Delgado » Thu Jan 19, 2006 10:40 pm

nuevamente.......gracias...... Antonio

Pero seguimos con el mismo problema, no desabilita los submenus.

[img][img]http://img371.imageshack.us/img371/3600/menua6lb.jpg[/img][/img]

y el Codigo es este (de acuerdo al ejemplo testbtn)

Code: Select all  Expand view
#Define COLOR_BTNFACE 15
#Define CLR_NBLUE  nRGB( 128, 128, 192)

#Include "FiveWin.ch"

Static oWndPrinc, oOut
Static cEmpresa, oFont
***************************
Function Main()
  Local oIcon, oCur, oBar, cUsuario
  Local oSpl, oUsuario, oBrush, oSay, oEmpresa
  Local oBtn[2], oMenu, lEnable := .F.
  DEFAULT cEmpresa := "Transporte Urbano de Poza Rica, S.A. de C.V."
  DEFAULT cUsuario := ""

  REQUEST DBFCDX
  RDDSETDEFAULT("DBFCDX")
  SET CENTURY ON
  SET DATE BRITISH
  SET DELETE ON
  SET EPOCH TO 1989
  SetHandleCount( 80 )
  Set3dLook(.T.)

  DEFINE ICON oIcon RESOURCE "A"
  DEFINE CURSOR oCur RESOURCE "Hand"
  DEFINE BRUSH oBrush RESOURCE "Brush2"
  DEFINE FONT oFont  NAME "Arial" SIZE 0, -11

  DEFINE WINDOW oWndPrinc ;
         TITLE "Sistema Administrativo para Transporte de Pasajeros para Windows" ;
         COLOR CLR_BLACK, GetSysColor(15)-RGB(30,30,30) ;
         MENU CreaMenu() ;
         ICON oIcon

         oWndPrinc:SetFont( oFont )

         DEFINE BUTTONBAR oBar 3DLOOK OF oWndPrinc SIZE 35, 35
                oBar:bLClicked := {|| 0 }
                oBar:bRClicked := {|| 0 }

                MENU oMenu POPUP
                     MenuItem "Informe de &Recaudaciones Diarias"
                     SEPARATOR
                     MenuItem "Deducciones a &Operadores" ;
                              RESOURCE "Oper16"
                         Menu
                            MenuItem "&Detallado (Ordenado por Operador)" When lEnable
                            MenuItem "&Acumulado (Ordenado por Operador)" When lEnable
                            MenuItem "&Individual"
                         EndMenu
                     MenuItem "Informe de &Pensiones a Operadores"
                     SEPARATOR
                     MenuItem "&Ingresos"
                         Menu
                           MenuItem "Mensual por &Unidad" When lEnable
                               Menu
                                  MenuItem "&Detallado (Ordenado por Unidad)"
                                  MenuItem "&Acumulado (Ordenado por Ingresos)"
                                  MenuItem "por &Unidad (en Detalle)"
                               EndMenu
                           MenuItem "Mensual por &Operador"  ;
                                    RESOURCE "Oper16" When lEnable
                               Menu
                                  MenuItem "&Detallado (Ordenado por Operador)"
                                  MenuItem "&Acumulado (Ordenado por Ingresos)"
                                  MenuItem "&Individual (en Detalle)"
                               EndMenu
                           MenuItem "Mensual Por &Empresas" When lEnable
                           MenuItem "Mensual Por &Bases"
                           SEPARATOR
                           MenuItem "Anual por &Unidad"
                           MenuItem "Anual por &Operador" ;
                                    RESOURCE "Oper16"
                                Menu
                                  MenuItem "&Global"
                                  MenuItem "&Individual"
                                EndMenu
                           MenuItem "Anual por &Empresas" When lEnable
                           MenuItem "Anual por &Bases"
                     EndMenu
                     SEPARATOR
                     MenuItem "&Generacion de Disco de Entregas" When lEnable
                ENDMENU

                DEFINE BUTTON oBtn[1] OF oBar    ;
                       RESOURCE "EXIT","EXIT"   ;
                       ACTION oWndPrinc:End()       ;
                       MESSAGE " Salir del Sistema" ;
                       TOOLTIP "Salir del Sistema"  ;
                       NOBORDER

                DEFINE BUTTON oBtn[2] OF oBar ;
                       RESOURCE "PRINTER"     ;
                       MENU oMenu  ;
                       FONT oWndPrinc:oFont   ;
                       MESSAGE " Reportes del Sistema" ;
                       NOBORDER            ;
                       GROUP

         SET MESSAGE OF oWndPrinc TO " Prueba " CENTER NOINSET

                    oWndPrinc:oMsgBar:DateOn()

  ACTIVATE WINDOW oWndPrinc          ;
           VALID (oFont:End(), .T. ) ;
           MAXIMIZED


Return Nil
*******************
Function CreaMenu()
  Local oMenu
  Local lEnable := .F.

        MENU oMenu
            MenuItem "Primero"
              Menu
                MenuItem "Acerca1"
                  Menu
                    MenuItem "Punto1"
                    MenuItem "Punto2"
                      Menu
                        MenuItem "Parte1"
                        MenuItem "Parte2"
                        MenuItem "Parte3" When lEnable
                      EndMenu
                    MenuItem "Punto3" When lEnable
                  EndMenu
                MenuItem "Acerca2"
                MenuItem "Acerca3" When lEnable
              EndMenu
            MenuItem "Segundo"
        EndMenu

Return(oMenu)
*******************************************


Saludos

Marco A. Delgado.
User avatar
Marco A. Delgado
 
Posts: 126
Joined: Fri Oct 07, 2005 4:20 pm
Location: Veracruz, México

Postby Antonio Linares » Thu Jan 19, 2006 11:12 pm

Marco,

Lo curioso es que en el ejemplo samples\TestBtn.prg si haces WHEN .f. de un menuitem, se ve deshabilitado...

Corrijo lo anteriormente dicho: Es un bug. Al crear un submenu, falla. Vamos a revisarlo.
regards, saludos

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

Postby Antonio Linares » Thu Jan 19, 2006 11:25 pm

Marco,

Este cambio en la clase TWindow lo soluciona:

Code: Select all  Expand view
METHOD InitMenuPopup( hPopup, nIndex, lSystem ) CLASS TWindow

   local oPopup

   if ! lSystem
      if ! Empty( ::oPopup ) // .and. ::oPopup:hMenu == hPopup
         ::oPopup:Initiate()
         if ( oPopup := ::oPopup:GetPopup( hPopup ) ) != nil
            oPopup:Initiate()
         endif
         return nil
      endif
      if ! Empty( ::oMenu )
         ...
regards, saludos

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

Postby Marco A. Delgado » Fri Jan 20, 2006 2:32 am

solucionado... nuevamente gracias Antonio

solo una cosa, como hago para que pulsando el boton (no en triangulito que se forma del menu), sobresalga el mismo menu

antes con clipper y fw si se podia haciendo esto.

Code: Select all  Expand view
   DEFINE BUTTON RESOURCE "Concauto" OF oBar ;
          PROMPT "Reportes" MENU MenuReport(This) ;
          ACTION MenuReport(This) ;
          MESSAGE "Genera Diversos Reportes del Sistema ..." ;
          NOBORDER GROUP TOOLTIP "Reportes ..."


pero ahora se hace de menera diferente, me podrias orientar como hacerlo Gracias.

Saludos

Marco A. Delgado
User avatar
Marco A. Delgado
 
Posts: 126
Joined: Fri Oct 07, 2005 4:20 pm
Location: Veracruz, México

Postby Antonio Linares » Fri Jan 20, 2006 8:38 am

Marco,

Lo que has de hacer es usar la opción ... MENU ... como la estás usando, y en la cláusula ACTION llamar a tu función que crea y muestra el popup.
regards, saludos

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

Postby Marco A. Delgado » Fri Jan 20, 2006 2:41 pm

:?:

Disculpa....me podrias dar un ejemplo mas claro.

Saludos

Marco A. Delgado.
User avatar
Marco A. Delgado
 
Posts: 126
Joined: Fri Oct 07, 2005 4:20 pm
Location: Veracruz, México

Postby Antonio Linares » Fri Jan 20, 2006 3:22 pm

Marco,

Más fácil, prueba así:

Code: Select all  Expand view
   DEFINE BUTTON oBtn RESOURCE "Concauto" OF oBar ;
          PROMPT "Reportes" ;
          MENU oPopup ;
          ACTION ( oBtn:lCaptured := .t., oBtn:LButtonUp( 8, 35 ) ) ;
          MESSAGE "Genera Diversos Reportes del Sistema ..." ;
          NOBORDER GROUP TOOLTIP "Reportes ..."


Prueba con valores mayores a 35, si no te funcionase.
regards, saludos

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

Postby Marco A. Delgado » Fri Jan 20, 2006 4:31 pm

ok funciono... muchas gracias por tus respuestas.


Saludos

Marco A. Delgado
User avatar
Marco A. Delgado
 
Posts: 126
Joined: Fri Oct 07, 2005 4:20 pm
Location: Veracruz, México

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 137 guests