Ayuda URGENTE Menu con Opcion de Macros

Post Reply
mantonio_08
Posts: 330
Joined: Fri May 25, 2007 9:06 pm

Ayuda URGENTE Menu con Opcion de Macros

Post by mantonio_08 »

Amigos:

Tengo una base de datos con las opciones del Menu del Sistema, cargo en arreglo todas las opciones. El menu muestra correctamente todas las opciones y barra de iconos, pero el problema es el siguiente:

. NO EJECUTA LA ACCION, QUE ESTA CARGADA EN EL ARREGLO, POR EJEMPLO: PRINTERSETUP(), CLIENTES(). PRECIONO EL ICONO, O LA OPCION DEL MENU Y NADA.

¿Cual es el Error ?

Saludos,
Antonio
Aqui se genera el menu de barra
For i=1 to b
if val(cCod_men)<888
DEFINE BUTTON OF oBar ;
TOOLTIP (cDet_msg) NOBORDER FILE cUbi_ico;
ACTION (cAcc_opc) // Esta Opcion no se ejecuta
else
DEFINE BUTTON OF oBar ;
TOOLTIP (cDet_msg) FILE cUbi_ico;
ACTION (cAcc_opc) // Esta Opcion no se ejecuta
endif
Next (i)
User avatar
laugusto
Posts: 62
Joined: Fri Apr 28, 2006 4:06 pm

Post by laugusto »

Amigo, mira las lineas abajo, é assim que hago:

Code: Select all


   @ nlin, 130.4 HBUTTON m->bBtn[nbt] PROMPT Var_[2] + CRLF + Var_[3] OF oWnd SIZE 160, 80 FONT m->oFont;
      ACTION( IF( !Empty( Var_[8] ),;
      ( IF( Verpriore( Var_[6], Var_[7] ), (&(Var_[8])( oWnd, dCod, pvalorf, .f. )), nil )), nil ));
          TOOLTIP Var_[4] CANCEL;
      COLORS { |oB| IF( oB:lMouseOver,CLR_WHITE, CLR_BLACK )},;
             { |oB| IF( oB:lMouseOver, {CLR_WHITE,CLR_BLUE },;
                                       {CLR_HGRAY,CLR_HGRAY} ) } BORDER TEXT POSITION ON_RIGHT
Espero de ajude, Saludos desde Brasil,
Luiz Augusto
São José dos Pinhais - PR
BRASIL
fwh + harbour + workshop + velhos bat´s
mantonio_08
Posts: 330
Joined: Fri May 25, 2007 9:06 pm

Post by mantonio_08 »

laugusto:

Muchas gracias por tu respuesta.

Uso el Menu estilo Xp, y su libreria MENUXH.LIB, y no logro solucionar el problema, lo uso asi ACTION (cAcc_opc), o con macro ACTION &(cAcc_opc)) no lo acepta.

Sigo muy complicado,

Saludos
Antonio

Al Usar la &, tengo este error al ejecutar el icono PRINTERSETUP()

***
Application
===========
Path and name: c:\sistemas\menu.Exe (32 bits)
Size: 1,294,336 bytes
Time from start: 0 hours 0 mins 2 secs
Error occurred at: 07/10/2007, 22:03:49
Error description: Error BASE/1065 Argument error: &
Args:
[ 1] = U

Stack Calls
===========
Called from: menu.prg => (b)MAIN(85)
Called from: BTNBMP.PRG => TBTNBMP:CLICK(0)
Called from: BTNBMP.PRG => TBTNBMP:LBUTTONUP(0)
Called from: window.prg => TWINDOW:HANDLEEVENT(0)
Called from: CONTROL.PRG => TBTNBMP:HANDLEEVENT(0)
Called from: window.prg => _FWH(3164)
Called from: => WINRUN(0)
Called from: window.prg => TMDIFRAME:ACTIVATE(883)
Called from: menu.prg => MAIN(107)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Prueba a hacerlo así:

cAction = cAcc_opc

... ACTION &cAction
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Patricio Avalos Aguirre
Posts: 1028
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile
Contact:

Post by Patricio Avalos Aguirre »

Antonio

Prueba esto..

Code: Select all

For i=1 to b
 	if val(cCod_men[i])<888
		MakeButton( oBar, i, cDet_msg, cUbi_ico, cAcc_opc, .t. )
	else
		MakeButton( oBar, i, cDet_msg, cUbi_ico, cAcc_opc, .f. )
	endif
Next i

function MakeButton( oBar, i, cDet_msg, cUbi_ico, cAcc_opc, lNoborder )

	if lNoborder
		DEFINE BUTTON OF oBar ;
			TOOLTIP (cDet_msg[i]) NOBORDER FILE cUbi_ico[i];
			ACTION Eval( &(cAcc_opc[i]))
	else
		DEFINE BUTTON OF oBar ;
		TOOLTIP (cDet_msg[i]) FILE cUbi_ico[i];
		ACTION Eval( &(cAcc_opc[i]))	
	endif

return( nil )
Saludos..
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
mantonio_08
Posts: 330
Joined: Fri May 25, 2007 9:06 pm

Post by mantonio_08 »

Hola Patricio:

Primero que nada muchas gracias por tu ayuda. Mira despues de aplicar lo que Antonio me indico, me arrojo el mismo error. Pero al aplicar tu solucion, puedo generar el menu, el problema que me lanza un error al seleccionar un icono, en este caso PrinterSetup(), me muestra en pantalla la configuracion de la impresora, pero al Aceptar o Cancelar, me da el siguiente error:

Saludos,
Antonio


Application
===========
Path and name: C:\SISTEMAS\MENU.EXE (32 bits)
Size: 1,294,336 bytes
Time from start: 0 hours 0 mins 4 secs
Error occurred at: 08/10/2007, 17:36:58
Error description: Error BASE/1004 Class: 'NUMERIC' has no exported method: EVAL
Args:
[ 1] = N 7154

Stack Calls
===========
Called from: => EVAL(0)
Called from: menu.prg => (b)MAKEBUTTON(387)
Called from: BTNBMP.PRG => TBTNBMP:CLICK(0)
Called from: BTNBMP.PRG => TBTNBMP:LBUTTONUP(0)
Called from: window.prg => TWINDOW:HANDLEEVENT(0)
Called from: CONTROL.PRG => TBTNBMP:HANDLEEVENT(0)
Called from: window.prg => _FWH(3164)
Called from: => WINRUN(0)
Called from: window.prg => TMDIFRAME:ACTIVATE(883)
Called from: menu.prg => MAIN(114)

System
======
CPU type: 1600 Mhz
Hardware memory: 160 megs

Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %

Compiler version: xHarbour build 0.99.71 Intl. (SimpLex)
Windows version: 4.10, Build 67766446 A

Windows total applications running: 21
1
2 Sistema Club Mundo Chico
3 VERCE v4.3, C:\Sistemas\menu.vrc
4 Finalizado - BMake
5 Multi-Edit - [C:\Sistemas\Menu.prg]
6 Club1
7 OLEChannelWnd
8 DDE Server Window
9 OleMainThreadWndName
10 About WinZip Quick Pick
11 MS_WebcheckMonitor
12 STI Monitor
13 Spooler Process
14 QueueManagerLoader
15 Notification Wnd for RNAdmin
16 Medidor de energía
17 MySnoop
18 SYSTEM AGENT COM WINDOW
19 STM3 TrayIcon
20 MS-DOS
21 Program Manager

Variables in use
================
Procedure Type Value
==========================
EVAL
Local 1: A Len: 0
Local 2: U
Local 3: N 0
(b)MAKEBUTTON
Param 1: O Class: TBTNBMP
TBTNBMP:CLICK
Local 1: O Class: TBTNBMP
TBTNBMP:LBUTTONUP
Param 1: N 35
Param 2: N 23
Param 3: O Class: TBTNBMP
Local 1: U
Local 2: L .T.
TWINDOW:HANDLEEVENT
Param 1: N 514
Param 2: N 0
Param 3: N 2293783
TBTNBMP:HANDLEEVENT
Param 1: N 514
Param 2: N 0
Param 3: N 2293783
Local 1: O Class: TBTNBMP
_FWH
Param 1: N 2293783
Param 2: N 514
Param 3: N 0
Param 4: N 2293783
Param 5: N 6
Local 1: O Class: TBTNBMP
WINRUN
Param 1: N 2188
TMDIFRAME:ACTIVATE
Param 1: C "MAXIMIZED"
Param 2: U
Param 3: U
Param 4: U
Param 5: U
Param 6: B {|| ... }
Param 7: U
Param 8: B {|| ... }
Param 9: U
Param 10: U
Param 11: U
Param 12: U
Param 13: U
Param 14: U
Param 15: U
Param 16: U
Param 17: B {|| ... }
Param 18: U
Param 19: U
Local 1: O Class: TMDIFRAME
Local 2: U
Local 3: U
MAIN
Local 1: O Class: TBAR
Local 2: U
Local 3: U
Local 4: U
Local 5: U
Local 6: U
Local 7: U
Local 8: U
Local 9: U
Local 10: O Class: TMSGITEM
Local 11: U
Local 12: U
Local 13: U
Local 14: O Class: TBITMAP
Local 15: U
Local 16: U
Local 17: C "SISTEMA MENU"
Local 18: O Class: TFONT
Local 19: U
Local 20: U
Local 21: N 5
Local 22: C "BA"
Local 23: N 4
Local 24: A Len: 20
Local 25: A Len: 20
Local 26: A Len: 20
Local 27: A Len: 20
Local 28: A Len: 20
Local 29: A Len: 20
Local 30: A Len: 20
Local 31: A Len: 20
Local 32: A Len: 20

Linked RDDs
===========
DBF
DBFCDX

DataBases in use
================

1: => MEN_C RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
14 13 .F. .T.

Indexes in use TagName
=> Field->Tip_men+Field->Cod_men+FieldMEN_C1

Relations in use

Classes in use:
===============
1 HASHENTRY
2 HBCLASS
3 HBOBJECT
4 TWINDOW
5 TMDIFRAME
6 TMENU
7 TMENUITEM
8 TBRUSH
9 TMDICLIENT
10 TFONT
11 TCONTROL
12 TBAR
13 TRECT
14 TBTNBMP
15 TMSGBAR
16 TMSGITEM
17 TTIMER
18 TBITMAP
19 TDIALOG
20 ERROR
21 TREG32

Memory Analysis
===============
128 Static variables

Dynamic memory consume:
Actual Value: 0 bytes
Highest Value: 0 bytes
User avatar
Patricio Avalos Aguirre
Posts: 1028
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile
Contact:

Post by Patricio Avalos Aguirre »

antonio

Tu arreglo debiera estar asi

Code: Select all

cAcc_opc[1] := "{ || printsetup(), Clientes() }"
cAcc_opc[2] := "{ || funciox() }"

//siempre entre comilla
espero que te sirva..
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
mantonio_08
Posts: 330
Joined: Fri May 25, 2007 9:06 pm

Post by mantonio_08 »

Patricio:

Los datos los tengo en una base de datos donde todos _ son Character y _ asi al arroglo.

Saludos,
Antonio

****
Tip_men1="BA"
Sele Men_c
OrdSetFocus(1)
Men_c->(DbSeek(Tip_men1))
I=1


While (Men_c->tip_men=Tip_men1).and.!Men_c->(eof())
cCod_men=alltrim(Men_c->Cod_men)
cDet_iten=alltrim(Men_c->Det_iten)
cDet_msg=alltrim(Men_c->Det_msg)
cUbi_ico=alltrim(Men_c->Ubi_ico)+"\"+alltrim(Men_c->Nom_ico)+"."+alltrim(Men_c->Tip_ico)
cAcc_opc=alltrim(Men_c->Acc_opc)
b=i
dBskip()
if (Men_c->tip_men#Tip_men1).or.Men_c->(eof())
exit
endif
i=i+1
Enddo
User avatar
Patricio Avalos Aguirre
Posts: 1028
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile
Contact:

Post by Patricio Avalos Aguirre »

pero estan como code block

Code: Select all

"{|| ...}"

lo otro es que usaras un msginfo()

Code: Select all

function MakeButton( oBar, i, cDet_msg, cUbi_ico, cAcc_opc, lNoborder )

   if lNoborder
      DEFINE BUTTON OF oBar ;
         TOOLTIP (cDet_msg[i]) NOBORDER FILE cUbi_ico[i];
         ACTION ( MsgInfo( cAcc_opc[i] ), Eval( &(cAcc_opc[i])) )
   else
      DEFINE BUTTON OF oBar ;
      TOOLTIP (cDet_msg[i]) FILE cUbi_ico[i];
         ACTION ( MsgInfo( cAcc_opc[i] ), Eval( &(cAcc_opc[i])) )
   endif

return( nil ) 
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
mantonio_08
Posts: 330
Joined: Fri May 25, 2007 9:06 pm

Post by mantonio_08 »

Patricio:

Termine pasando los datos como "{|| ...}" y se soluciono el problema.

Muchas gracias por tu ayuda y disculpa todas las molestias.

. Una ultima pregunta:
Como controlo que no se ejecute una ACTION vacia, es decir que no trae una funcion a ejecutar.?



Saludos,
Antonio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

cAction = cAcc_opc

if ! Empty( cAction )
... ACTION &cAction
else
... (sin ACTION ) // Creas menuitem sin action
endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
mantonio_08
Posts: 330
Joined: Fri May 25, 2007 9:06 pm

Post by mantonio_08 »

Antonio:

Muchas gracias por tu respuesta.

Funciono perfecto.

Saludos,
Antonio


Antonio Linares wrote:cAction = cAcc_opc

if ! Empty( cAction )
... ACTION &cAction
else
... (sin ACTION ) // Creas menuitem sin action
endif
Post Reply