FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Menu.... ha habilitado....
Posts: 126
Joined: Fri Oct 07, 2005 04:20 PM
Menu.... ha habilitado....
Posted: Thu Jan 19, 2006 04:45 PM
Gracias Antonio

lo implemente y funciona con unos arreglos:

	 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][/img]

ahorita tengo esto en el codigo:

            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.

                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.

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.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Menu.... ha habilitado....
Posted: Thu Jan 19, 2006 08: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
Posts: 126
Joined: Fri Oct 07, 2005 04:20 PM
Menu.... ha habilitado....
Posted: Thu Jan 19, 2006 10:40 PM
nuevamente.......gracias...... Antonio

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

[img]http://img371.imageshack.us/img371/3600/menua6lb.jpg" alt="" loading="lazy">[/img]

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

#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.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Menu.... ha habilitado....
Posted: 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Menu.... ha habilitado....
Posted: Thu Jan 19, 2006 11:25 PM
Marco,

Este cambio en la clase TWindow lo soluciona:

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
Posts: 126
Joined: Fri Oct 07, 2005 04:20 PM
Menu.... ha habilitado....
Posted: Fri Jan 20, 2006 02: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.

   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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Menu.... ha habilitado....
Posted: Fri Jan 20, 2006 08: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
Posts: 126
Joined: Fri Oct 07, 2005 04:20 PM
Menu.... ha habilitado....
Posted: Fri Jan 20, 2006 02:41 PM

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

Saludos

Marco A. Delgado.

:?:

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Menu.... ha habilitado....
Posted: Fri Jan 20, 2006 03:22 PM
Marco,

M谩s f谩cil, prueba as铆:

   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
Posts: 126
Joined: Fri Oct 07, 2005 04:20 PM
Menu.... ha habilitado....
Posted: Fri Jan 20, 2006 04:31 PM

ok funciono... muchas gracias por tus respuestas.

Saludos

Marco A. Delgado

Continue the discussion