Error menu name variable type accepts only charracter
Moderator: Rathinagiri
Error menu name variable type accepts only charracter
hello people can not assign a variable to a menu other than character
following example and the image
#include <hmg.ch>
Function Main
LOCAL aMenu := array(10)
Load Window Main
aMenu[1] := "MNU1" -- > does not work
cMenu := "MNU1"
Main.Center
Main.Activate
Return
following example and the image
#include <hmg.ch>
Function Main
LOCAL aMenu := array(10)
Load Window Main
aMenu[1] := "MNU1" -- > does not work
cMenu := "MNU1"
Main.Center
Main.Activate
Return
- Attachments
-
- MENU PRINCIPAL.png (15.41 KiB) Viewed 4943 times
- danielmaximiliano
- Posts: 2612
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: Error menu name variable type accepts only charracter
try this:
a modification of the example menu in hmg.3.0.40
a modification of the example menu in hmg.3.0.40
- Attachments
-
- Crimson Editor - [Chmg.3.0.40SAMPLESMENU.1demo.jpg (120.63 KiB) Viewed 4938 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
- danielmaximiliano
- Posts: 2612
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: Error menu name variable type accepts only charracter
other ideas
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
- danielmaximiliano
- Posts: 2612
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: Error menu name variable type accepts only charracter
Ola Jair:
Try This Main.fmg
Try This Main.fmg
Code: Select all
* HMG-IDE Form Designer Generated Code
* (c) Roberto Lopez - http://sites.google.com/site/hmgweb
DEFINE WINDOW TEMPLATE AT 342 , 504 WIDTH 550 HEIGHT 350 VIRTUAL WIDTH Nil VIRTUAL HEIGHT Nil TITLE "Macro Work" ICON NIL MAIN CURSOR NIL ON INIT Nil ON RELEASE Nil ON INTERACTIVECLOSE Nil ON MOUSECLICK Nil ON MOUSEDRAG Nil ON MOUSEMOVE Nil ON SIZE Nil ON MAXIMIZE Nil ON MINIMIZE Nil ON PAINT Nil BACKCOLOR Nil NOTIFYICON NIL NOTIFYTOOLTIP NIL ON NOTIFYCLICK Nil ON GOTFOCUS Nil ON LOSTFOCUS Nil ON SCROLLUP Nil ON SCROLLDOWN Nil ON SCROLLLEFT Nil ON SCROLLRIGHT Nil ON HSCROLLBOX Nil ON VSCROLLBOX Nil
DEFINE MAIN MENU
DEFINE POPUP "Principal" NAME &(aMENU[1])
END POPUP
END MENU
DEFINE MAIN MENU
DEFINE POPUP "Secundario" NAME &(aMENU[2])
END POPUP
END MENU
DEFINE BUTTON Button_1
ROW 150
COL 280
WIDTH 100
HEIGHT 28
ACTION Nil
CAPTION "Button_1"
FONTNAME "Arial"
FONTSIZE 9
TOOLTIP ""
FONTBOLD .F.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
ONGOTFOCUS Nil
ONLOSTFOCUS Nil
HELPID Nil
FLAT .F.
TABSTOP .T.
VISIBLE .T.
TRANSPARENT .F.
MULTILINE .F.
PICTURE Nil
PICTALIGNMENT TOP
END BUTTON
END WINDOW
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Re: Error menu name variable type accepts only charracter
ola daniel funcionou como vc sugeriu porem nao aceita modificar o objeto pelo nome olha o exemplo
o que vou fazer seria um controle de modulo de usuarios onde posso adicionar os modulos para cada usuario sendo assim preciso habilitar ou desabilitar menus e toolbar esse é o proposito.
#include <hmg.ch>
Function Main
declare window main
LOCAL aMenu := array(10)
Load Window Main
aMenu[1] := "MNU1" && -- > does not work
cMenu := "MNU1"
MODIFY CONTROL MNU1 OF Main ENABLED .F. // NÃO FUNCIONA
Main.Center
Main.Activate
Return
o que vou fazer seria um controle de modulo de usuarios onde posso adicionar os modulos para cada usuario sendo assim preciso habilitar ou desabilitar menus e toolbar esse é o proposito.
#include <hmg.ch>
Function Main
declare window main
LOCAL aMenu := array(10)
Load Window Main
aMenu[1] := "MNU1" && -- > does not work
cMenu := "MNU1"
MODIFY CONTROL MNU1 OF Main ENABLED .F. // NÃO FUNCIONA
Main.Center
Main.Activate
Return
Re: Error menu name variable type accepts only charracter
Muito obrigado Daniel Funcionou tive que modificar um pouco a declaração da variavel antes do Load Window
#include <hmg.ch>
Function Main
declare window main
LOCAL aMenu := array(10)
aMenu[1] := "MNU1"
Load Window Main
MODIFY CONTROL MNU1 OF Main ENABLED .F. // NÃO FUNCIONA
Main.Center
Main.Activate
Return
#include <hmg.ch>
Function Main
declare window main
LOCAL aMenu := array(10)
aMenu[1] := "MNU1"
Load Window Main
MODIFY CONTROL MNU1 OF Main ENABLED .F. // NÃO FUNCIONA
Main.Center
Main.Activate
Return
- Attachments
-
- MENU PRINCIPAL2.png (10.44 KiB) Viewed 4876 times
Last edited by jairpinho on Sun Apr 22, 2012 7:34 pm, edited 1 time in total.
- danielmaximiliano
- Posts: 2612
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: Error menu name variable type accepts only charracter
según la referencia de HMG para el Control Main Menu.jairpinho wrote:ola daniel funcionou como vc sugeriu porem nao aceita modificar o objeto pelo nome olha o exemplo
o que vou fazer seria um controle de modulo de usuarios onde posso adicionar os modulos para cada usuario sendo assim preciso habilitar ou desabilitar menus e toolbar esse é o proposito.
#include <hmg.ch>
Function Main
declare window main
LOCAL aMenu := array(10)
Load Window Main
aMenu[1] := "MNU1" && -- > does not work
cMenu := "MNU1"
MODIFY CONTROL MNU1 OF Main ENABLED .F. // NÃO FUNCIONA
Main.Center
Main.Activate
Return
não pode mudar os valores no menu principal
Code: Select all
DEFINE MAINMENU [ PARENT <ParentWindowName> ]
DEFINE POPUP <cPopupCaption> [ NAME <PopupName> ]
MENUITEM <cItemCaption>
ONCLICK <ActionProvedureName> | <bBlock>
[ NAME <MenuItemName>]
[ IMAGE <cImageName> ]
[ CHECKED <lValue> ]
..
..
[ SEPARATOR ]
...
...
END POPUP
...
...
END MENU
MainMenu Properties:
- Parent (R)
R: Read-Only
MenuItem Properties:
- Name (R)
- Checked
- Enabled
- Image
R: Read-Only
MenuItem Events:
- OnClick (R)
R: Read-Onl
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
- danielmaximiliano
- Posts: 2612
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: Error menu name variable type accepts only charracter
Hola Jair:
aqui tiene un ejemplo de utilizar una Macro "&" para crear menu personalizado.
Main.prg
Main.fmg
aqui tiene un ejemplo de utilizar una Macro "&" para crear menu personalizado.
Main.prg
Code: Select all
#include <hmg.ch>
Function Main
Public aMenu := {'JairMenu' , 'RobertoMenu' , 'DanielmaximilianoMenu', 'OtherMenu' }
Public aPopup:= {'Popup' , 'Popup' , 'Popup' }
Public aItems:= {'Items1' , 'Items1' , 'Items1' }
Public aUsers:= {'Jair' , 'Roberto', 'DanielMaximiliano' , 'Other' }
Public cUsers := getenv("UserName")
Public cPopup := 'Principal'
Public xMenu := 0
Load Window Main
Main.Center
Main.Activate
Return
Function Mainname(cUser)
Local cMainname := ''
Do case
Case cUsers = 'Jair'
cMainname := aMenu[1]
xMenu := 1
Case cUsers = 'Roberto'
cMainname := aMenu[2]
xMenu := 2
Case cUsers = 'Other'
cMainname := aMenu[3]
xMenu := 3
Case cUsers = 'DanielMaximiliano'
cMainname := aMenu[3]
xMenu := 4
Endcase
cPopup := cPopup + cMainname
Return (cMainname)
* HMG-IDE Form Designer Generated Code
* (c) Roberto Lopez - http://sites.google.com/site/hmgweb
DEFINE WINDOW TEMPLATE AT 183 , 360 WIDTH 550 HEIGHT 350 VIRTUAL WIDTH Nil VIRTUAL HEIGHT Nil TITLE "Macro Work" ICON NIL MAIN CURSOR NIL ON INIT Nil ON RELEASE Nil ON INTERACTIVECLOSE Nil ON MOUSECLICK Nil ON MOUSEDRAG Nil ON MOUSEMOVE Nil ON SIZE Nil ON MAXIMIZE Nil ON MINIMIZE Nil ON PAINT Nil BACKCOLOR Nil NOTIFYICON NIL NOTIFYTOOLTIP NIL ON NOTIFYCLICK Nil ON GOTFOCUS Nil ON LOSTFOCUS Nil ON SCROLLUP Nil ON SCROLLDOWN Nil ON SCROLLLEFT Nil ON SCROLLRIGHT Nil ON HSCROLLBOX Nil ON VSCROLLBOX Nil
DEFINE MAIN MENU
DEFINE POPUP &("Mainname()") NAME &(aMenu[xMenu])
END POPUP
END MENU
DEFINE STATUSBAR FONT "Arial" SIZE 9
STATUSITEM "User : "+cUsers WIDTH 300 ACTION Nil ICON "Users" TOOLTIP "Usuario Logueado"
END STATUSBAR
DEFINE BUTTON Button_1
ROW 90
COL 200
WIDTH 100
HEIGHT 28
ACTION Nil
CAPTION "Button_1"
FONTNAME "Arial"
FONTSIZE 9
TOOLTIP ""
FONTBOLD .F.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
ONGOTFOCUS Nil
ONLOSTFOCUS Nil
HELPID Nil
FLAT .F.
TABSTOP .T.
VISIBLE .T.
TRANSPARENT .F.
MULTILINE .F.
PICTURE Nil
PICTALIGNMENT TOP
END BUTTON
END WINDOW
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO