david7
30th June 2009, 07:47
Hi,

I have been trying to build a menu browser using GBF just as shown in the documentation. I have noticed that there is a bit difference between Baan IV and higher version. Anyhow, has anyone been successful activating the double click for the leafs?

I only got to build my own structure using gbf.add.interior, gbf.add.object, gbf.set.leaf.icon and the other functions, but I can't do anything with it.

I have looked into the the gbf.menu.selected function but even the debugger does not get to it.

Any clues?

- D7

bdittmar
30th June 2009, 09:15
Hi,

I have been trying to build a menu browser using GBF just as shown in the documentation. I have noticed that there is a bit difference between Baan IV and higher version. Anyhow, has anyone been successful activating the double click for the leafs?

I only got to build my own structure using gbf.add.interior, gbf.add.object, gbf.set.leaf.icon and the other functions, but I can't do anything with it.

I have looked into the the gbf.menu.selected function but even the debugger does not get to it.

Any clues?

- D7

Hello,

do you mean your own MENUEBROWSER or a graphical BOM using GBF ?

Regards

david7
30th June 2009, 09:33
I need to build something more like the graphical BOM.

But when I double click the item, I would like it to execute a specific function. I have already seen your advice in this (http://www.baanboard.com/baanboard/showthread.php?t=16311) post. But I couldn't get the gbf.menu.selected to work.

Can you help?

david7
30th June 2009, 09:41
Here is my current code:

function main()
{
long retval |to test return values

retval = gbf.init(gbf.current.library(), "Testing THE TREE!!!", GBF.MENU.ALL + GBF.MENU.FILE.OPEN +
GBF.MENU.FILE.READ,0,0) | GBF.BUTTON

if retval < 0 then
exit(retval)
endif

exit(gbf.start(GBF.READ.ALL,GBF.SHOW.ALL)) |Show and read the first level
}

|************************************************************************
|* functions to read a tables with parent child relations
|* here this will be ttdsk900 and ttdsk903
|************************************************************************

function extern long gbf.get.children(const string Icongroup(),
long object.value, long level)
{
long retval

if strip$(Icongroup) = "Sales" then
retval = gbf.set.leaf.icon( "Sales",
"printer1",
"printer1",
FALSE)
if retval < 0 then
retval = 0 | indicates default leaf icon
endif

if gbf.add.object("printer1", "Sales LEAF 1", 8,true, retval,0) < 0 then | instead of GBF.LEAF in Baan4c4 its true if it is a leaf.
return (GBF.DO.EXIT)
endif

| gbf.set.menu.function("","zoom.to$",1)

endif



return (0)
}

function extern long gbf.get.top.level()
{

if gbf.add.interior("Sales", "Sales",0) < 0 then
return (GBF.DO.EXIT)
endif

return (0)
}

function extern long gbf.menu.selected( long obj.id, const string object.key(), long object.value, long menu.option)
{

message("you clicked gbf.menu.selected!")
return (0)

}

bdittmar
30th June 2009, 10:05
Hello,

it have to look like :

function extern long gbf.menu.selected( long obj.id, const string object.key(), long object.value, long menu.option)
{
domain tcitem item.c
domain tccprj cprj.c
domain tcmcs.str3 level.c

level.c(1;3) = object.key(1;3)
cprj.c = object.key(4;6)
item.c = object.key(10;16)
tiitm001.item = item.c
tipcs021.cprj = cprj.c
tipcs021.item = item.c
tibom010.mitm = item.c
tibom010.pono = 0
tipcs022.cprj = cprj.c
tipcs022.mitm = item.c
tipcs022.pono = 0

on case menu.option
case app.item(1):
if isspace(cprj.c) then
|BD20050715 Only display itemdata
| zoom.to$("tiitm0101s000",z.session,prog.name$,"",0)
| #pragma used session tiitm0101s000
| zoom.to$("tiitm0501s000",z.session,prog.name$,"",0)
| #pragma used session tiitm0501s000
zoom.to$("dhitm0501m001",z.session,prog.name$,"",0)
#pragma used session dhitm0501m001
else
zoom.to$("tipcs2121s000",z.session,prog.name$,"",0)
#pragma used session tipcs2121s000
endif
break
case app.item(2):
if isspace(cprj.c) then
|BD20050715 Only display !
| zoom.to$("tibom1110s000",z.session,prog.name$,"",0)
| #pragma used session tibom1110s000
zoom.to$("tibom1510s000",z.session,prog.name$,"",0)
#pragma used session tibom1510s000
else
......................>>>>>>

Regards

david7
30th June 2009, 10:22
The problem is that it does not go to the gbf.menu.selected function at all! I tried to debug it and the function is not called.

Maybe something wrong in how I define the object in gbf.add.object?

george7a
30th June 2009, 13:51
I was successful activating the node by this code:

long menu.id,rc,hwnd.func
extern domain tcmcs.long type.help


function main()
{
long retval |to test return values

retval = gbf.init(gbf.current.library(), "Testing THE TREE!!!", GBF.MENU.ALL + GBF.MENU.FILE.OPEN +GBF.MENU.FILE.READ,
0,
GBF.OPT.DEFAULT + GBF.OPT.DEBUG) | GBF.BUTTON

if retval < 0 then
exit(retval)
endif

exit(gbf.start(GBF.READ.ALL,GBF.SHOW.ALL)) |Show and read the first level
}

|************************************************************************
|* functions to read a tables with parent child relations
|* here this will be ttdsk900 and ttdsk903
|************************************************************************

function extern long gbf.get.children(const string Icongroup(),
long object.value, long level)
{
long retval

if strip$(Icongroup) = "Sales" then
retval = gbf.set.leaf.icon( "Sales",
"printer1",
"printer1",
FALSE)
if retval < 0 then
retval = 0 | indicates default leaf icon
endif


menu.id = gbf.set.menu.head("The new function", 0,0)
hwnd.func = gbf.set.menu.function(gbf.current.library(), "myfunc.leaf", TRUE ) | only for leaf
rc = gbf.set.menu.item( menu.id, "The new function","",true, hwnd.func, 0 ,0)


if gbf.add.object("printer1", "Sales LEAF 1", 8,true, retval,0) < 0 then | instead of GBF.LEAF in Baan4c4 its true if it is a leaf.
return (GBF.DO.EXIT)
endif

| gbf.set.menu.function("","zoom.to$",1)

endif

return (0)
}

function extern long gbf.get.top.level()
{
if gbf.add.interior("Sales", "Sales",0) < 0 then
return (GBF.DO.EXIT)
endif

return (0)
}

function extern long gbf.menu.selected( long obj.id, const string object.key(), long object.value, long menu.option)
{
message("you clicked gbf.menu.selected!")
return (0)
}

function extern long myfunc.leaf(const long obj.id,
const string obj.key(),
const long obj.value,
const long obj.menu)
{
message("CLICKED THE NEW FUNCTION")
return(0)
}

However, I could not get the original gbf.menu.selected function to work yet.

I hope it helps,

- George