Back to Four Js Website
Four Js Customer Forum
Subscribe for automatic updates:
RSS
Sign in for full access
|
Help
Four Js Development Tools Forum
>
Discussions by product
>
Genero BDL
>
startmenu with om.dom
Most recent posts
Pages: [
1
]
« previous
next »
Reply
|
Print
Author
Topic: startmenu with om.dom (Read 8685 times)
Luca B.
Posts: 5
startmenu with om.dom
«
on:
January 27, 2017, 03:09:34 pm »
Hi all,
i try to create a new start menu dynamically with the om.domnode method.
this is my code:
OPEN WINDOW win01 WITH 20 ROWS , 50 COLUMNS
LET txt_menu = "Prog 1.0 - ",
LET aui = ui.interface.getRootNode()
LET sm = aui.createChild("StartMenu") -
CALL ui.Interface.loadActionDefaults(name_4ad)
CALL ui.Interface.loadStyles(name_4st)
CALL ui.Interface.setImage("image")
CALL ui.Interface.setType("container")
CALL ui.Interface.SetName("menu"||id)
CALL ui.Interface.setText(txt_menu)
LET smg = createStartMenuGroup(sm,"Ordering")
LET smc = createStartMenuCommand(smg,"Orders","fglrun orders.42r",NULL)
LET smc = createStartMenuCommand(smg,"Customers","fglrun custs.42r",NULL)
LET smc = createStartMenuCommand(smg,"Items","fglrun items.42r",NULL)
LET smc = createStartMenuCommand(smg,"Reports","fglrun reports.42r",NULL)
LET smg = createStartMenuGroup(sm,"Configuration")
LET smc = createStartMenuCommand(smg,"Database","fglrun dbseconf.42r",NULL)
LET smc = createStartMenuCommand(smg,"Users","fglrun userconf.42r",NULL)
LET smc = createStartMenuCommand(smg,"Printers","fglrun prntconf.42r",NULL)
MENU "Example"
COMMAND "Quit"
EXIT PROGRAM
END MENU
close window win01
END MAIN
FUNCTION createStartMenuGroup(p,t)
DEFINE p om.DomNode
DEFINE t STRING
DEFINE s om.DomNode
LET s = p.createChild("StartMenuGroup")
CALL s.setAttribute("text",t)
RETURN s
END FUNCTION
FUNCTION createStartMenuCommand(p,t,c,i)
DEFINE p om.DomNode
DEFINE t,c,i STRING
DEFINE s om.DomNode
LET s = p.createChild("StartMenuCommand")
CALL s.setAttribute("text",t)
CALL s.setAttribute("exec",c)
CALL s.setAttribute("image",i)
RETURN s
END FUNCTION
the menu work fine but is generated in the window "screen" and not in my "win01".
is possible generate them in a window different from the screen?
in the window "screen" the command
CALL ui.Interface.SetName("menu"||id)
CALL ui.Interface.setText(txt_menu)
doesnėt work! why?
thanks
Sebastien F.
Posts: 545
Re: startmenu with om.dom
«
Reply #1 on:
January 27, 2017, 04:23:05 pm »
Hello Luca,
StartMenu was implemented before Genero introduced TreeViews.
You may want to consider to implement your program starter with TreeView, to have full control...?
You can have a look at the FGLDIR/demo/demo.4gl program.
Seb
Leo S.
Posts: 129
Re: startmenu with om.dom
«
Reply #2 on:
January 27, 2017, 04:46:25 pm »
Hi Luca, the reason that you don't see the start menu in your own window is that a "normal" window does not have a "startMenuPosition" style attribute set (see $FGLDIR/lib/default.4st), only Window.main has set <StyleAttribute name="startMenuPosition" value="menu" />
The implicit opened "screen" window has the "main" style set, thats why you see it only on "screen".
Now just give your window the main style
OPEN WINDOW win01 WITH 20 ROWS , 50 COLUMNS ATTRIBUTE(STYLE="main")
and you see it also in your window.
Nevertheless you can do everything you do with win01 also with "screen" so there is no reason to open an extra window.
<<CALL ui.Interface.SetName("menu"||id)
<<CALL ui.Interface.setText(txt_menu)
These API calls are foreseen for MDI containers, you can use either
CALL fgl_setTitle(txt_menu) --easy
or
DEFINE w ui.Window
LET w=ui.Window.getCurrent()
CALL w.setText(txt_menu) --you need a window variable
HTH and Regards, Leo
Luca B.
Posts: 5
Re: startmenu with om.dom
«
Reply #3 on:
January 27, 2017, 06:46:48 pm »
Quote
Hi Luca, the reason that you don't see the start menu in your own window is that a "normal" window does not have a "startMenuPosition" style attribute set (see $FGLDIR/lib/default.4st), only Window.main has set <StyleAttribute name="startMenuPosition" value="menu" />
The implicit opened "screen" window has the "main" style set, thats why you see it only on "screen".
Now just give your window the main style
OPEN WINDOW win01 WITH 20 ROWS , 50 COLUMNS ATTRIBUTE(STYLE="main")
and you see it also in your window.
Nevertheless you can do everything you do with win01 also with "screen" so there is no reason to open an extra window.
<<CALL ui.Interface.SetName("menu"||id)
<<CALL ui.Interface.setText(txt_menu)
These API calls are foreseen for MDI containers, you can use either
CALL fgl_setTitle(txt_menu) --easy
or
DEFINE w ui.Window
LET w=ui.Window.getCurrent()
CALL w.setText(txt_menu) --you need a window variable
HTH and Regards, Leo
Thanks Leo S.
with your solution now it work.
Quote
Hello Luca,
StartMenu was implemented before Genero introduced TreeViews.
You may want to consider to implement your program starter with TreeView, to have full control...?
You can have a look at the FGLDIR/demo/demo.4gl program.
Seb
for Sebastien
i saw this solution but i want to give to the final user two solution, the "StartMenu" and the "TreeView" and in my opinion the "TreeView" is not much user friendly for a Menu
thanks
Pages: [
1
]
Reply
|
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Discussion
=> Ask Reuben
=> WWDC21
-----------------------------
Discussions by product
-----------------------------
=> Products announcements
=> Genero BDL
=> GWS
=> GAS and GBC
=> GDC
=> Genero Mobile for Android or iOS
=> Genero Studio
=> Reporting tools (GRW, GRE)
-----------------------------
Jobs
-----------------------------
=> Jobs
Powered by SMF 1.1.21
|
SMF © 2015, Simple Machines
Loading...