pconde
18th August 2004, 13:04
This is a short example using the gbf function of tgbrgsrvlib. This display the bom of an item (standard or specific) in the browser. each manufactured item by dubble cliking it display its component.
The form contains only two field project code (cprj.f) and the item code (mitm.f)
You must create a library ($BSE/gif/bom) and set therein the icon that you want to use (see function init_data_gbf)
Two librairies must be included in this script : tggbfsrvlib and tgcomlogging
Developped with baanIV c4 SP7
I have attached a zip file with the icon that i have created
|******************************************************************************
|* spbom0719 0 VRC B40O c4 expl
|* Impression graphique Nomenclatures spécifiques
|* Philippe Condé
|* 2004-08-16
|******************************************************************************
|* Main table tipcs022 Nomenclatures spécifiques, Form Type 4
|******************************************************************************
|* License :
|* Copyright 2001 by <Philippe Conde>
|*
|* All Rights Reserved
|*
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation.
|*
|* Philippe Conde and Baanboard.com DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL <author> nor Baanboard.com BE LIABLE FOR ANY
|* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|*
|****************************** declaration section ***************************
declaration:
table ttipcs022 |* Nomenclatures spécifiques
table ttcmcs003 |* Magasins
table ttibom010 |* Nomenclatures de fabrication
table ttiitm001 |* Articles
table ttipcs021 |* Articles spécifiques
#include "itggbfdefs" |*
#include "itgcomlogging" |*
long rc
extern domain tcyesno txta.yn
domain tcmcs.str60 gbf_key
domain tcmcs.str60 gbf_desc
domain tcmcs.str60 head_key
domain tcdate mydate
extern domain tccprj cprj.f fixed
extern domain tcitem mitm.f fixed
long int.iconset1
long int.iconset2
long leaf.iconset1
long leaf.iconset2
|****************************** form section **********************************
form.1:
init.form:
mydate = date.num()
get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:
on.choice:
read.main.table()
|****************************** field section *********************************
field.mitm.f:
check.input:
if isspace(cprj.f) then
select tiitm001.* from tiitm001
where tiitm001._index1 = {:mitm.f}
as set with 1 rows
selectdo
if tiitm001.kitm <> tckitm.manufacture then
set.input.error("spbom07191")
|* Article non fabriqué
endif
selectempty
set.input.error("spbom07192")
|* Article inconnu
endselect
else
select tipcs021.* from tipcs021
where tipcs021._index1={:cprj.f, :mitm.f}
as set with 1 rows
selectdo
if tipcs021.kitm <> tcpuma.manufacture then
set.input.error("spbom07191")
|* Article non fabriqué
endif
selectempty
set.input.error("spbom07192")
|* Article inconnu
endselect
endif
|****************************** function section ******************************
functions:
function read.main.table()
{
rc = init_data_gbf()
}
function long read.pcs022( domain tccprj mycprj, domain tcitem myitem, domain tcmcs.str3 level )
{
select tipcs022.* from tipcs022
where tipcs022._index1 = {:mycprj, :myitem}
order by tipcs022._index1
selectdo
gbf_key(1;3) = edit$(tipcs022.pono,"999")
gbf_key(10;16) = tipcs022.sitm(1;16)
gbf_key(4;6) = " "
gbf_desc(1;3)=edit$(tipcs022.pono,"999")
gbf_desc(4;1) = " "
gbf_desc(5;6)=" "
gbf_desc(11;2) = " "
gbf_desc(13;16)=tipcs022.sitm(1;16)
gbf_desc(29;2)=" "
if tipcs022.opol = tcittb.customized then
gbf_desc(5;6) = tipcs022.cprj(1;6)
gbf_key(4;6) = tipcs022.cprj(1;6)
select tipcs021.* from tipcs021
where tipcs021._index1 = {:mycprj, :tipcs022.sitm}
as set with 1 rows
selectdo
gbf_desc(31;30)=tipcs021.dsca(1;30)
if tipcs021.kitm = tcpuma.manufacture then
rc = gbf.add.interior(gbf_key, gbf_desc, 0) |node
else
rc = gbf.add.object(gbf_key, gbf_desc, 1, true, leaf.iconset2) |leaf
endif
endselect
else
select tiitm001.* from tiitm001
where tiitm001._index1= {:tipcs022.sitm}
as set with 1 rows
selectdo
gbf_desc(31;30) = tiitm001.dsca(1;30)
if tiitm001.kitm = tckitm.manufacture then
rc = gbf.add.object(gbf_key, gbf_desc, 1, false, int.iconset2) | node
else
rc = gbf.add.leaf(gbf_key, gbf_desc, 0) | leaf
endif
endselect
endif
endselect
return(0)
}
function long read.bom010(domain tcitem myitem, domain tcmcs.str3 level)
{
select tibom010.*
from tibom010
where tibom010._index1 inrange {:myitem, 0}
and {:myitem, 999}
and (tibom010.exdt = 0 or
tibom010.exdt > :mydate )
order by tibom010._index1
selectdo
gbf_key(1;3) = edit$(tibom010.pono,"999")
gbf_key(4;6) = " "
gbf_key(10;16) = tibom010.sitm(1;16)
gbf_desc(1;3)=edit$(tibom010.pono,"999")
gbf_desc(4;1) = " "
gbf_desc(5;6)=" "
gbf_desc(11;2) = " "
gbf_desc(13;16)=tibom010.sitm(1;16)
gbf_desc(29;2)=" "
select tiitm001.* from tiitm001
where tiitm001._index1 = {:tibom010.sitm}
as set with 1 rows
selectdo
gbf_desc(31;30) = tiitm001.dsca(1;30)
if tiitm001.kitm = tckitm.manufacture then
rc = gbf.add.object(gbf_key, gbf_desc, 1, false, int.iconset2) |node
else
rc = gbf.add.leaf(gbf_key, gbf_desc, 0) | leaf
endif
endselect
endselect
return(0)
}
function extern long init_data_gbf()
{
long def.options
long ret_start
long retval
head_key(1;6) = cprj.f(1;6)
head_key(8;16) = mitm.f(1;16)
retval = gbf.init(gbf.current.library(), head_key,
bit.or(GBF.MENU.ALL , GBF.MENU.FILE.OPEN),
bit.or(GBF.BUTTON.ALL, GBF.BUTTON.FILE.QUIT),
def.options)
LogExecErrorReturn(retval, "gbf.init()")
int.iconset1 = gbf.set.interior.icon( "bom",
"specm.normal", |unselected.closed
"specm.open", |unselected.open
"specm.closed", |selected.closed
"specm.open", |selected.open
true ) |Défault
int.iconset2 = gbf.set.interior.icon( "bom",
"standm.normal", |unselected.closed
"standm.normal", |unselected.open
"standm.select", |selected.closed
"standm.select", |selected.open
false )
leaf.iconset1 = gbf.set.leaf.icon( "bom",
"purs.normal",
"purs.select",
TRUE)
leaf.iconset2 = gbf.set.leaf.icon( "bom",
"pursp.normal",
"pursp.select",
false)
retval = gbf.set.key.desc.length(60, 30)
LogExecErrorReturn(retval, "gbf.set.key.desc.length(%d, %d)",
60, 30)
retval = gbf.set.sort.strategy( GBF.SORT.DESC
+ GBF.SORT.ASCENDING
+ GBF.SORT.INSENSITIVE)
LogExecError(retval, "gbf.set.sort.strategy()")
retval = gbf.set.open.strategy( GBF.OPEN.AGAIN
+ GBF.OPEN.CURSEL
+ GBF.OPEN.READALL)
LogExecError(retval, "gbf.set.open.strategy()")
ret_start = gbf.start(1, 1)
return (0)
}
function long find.bom(const string key.c())
{
long retval
domain tcitem item.c
domain tccprj cprj.c
domain tcmcs.str3 level
level(1;3) = key.c(1;3)
cprj.c = key.c(4;6)
item.c = key.c(10;16)
if isspace(cprj.c) then
retval = read.bom010(item.c,level)
else
retval = read.pcs022(cprj.c,item.c, level)
endif
return (0)
}
function extern long gbf.get.top.level()
{
head_key(1;3) = " "
head_key(4;6) = cprj.f(1;6)
head_key(10;16) = mitm.f(1;16)
return (find.bom(head_key))
}
function extern long gbf.get.children(const string key(),
long value,
long level)
{
return (find.bom(key))
}
function extern long gbf.save(
const long object.id,
const string object.key(),
const long object.value,
const long menu.value)
{
| Doesn't need save already in tables :-)
return (0)
}
pconde
30th September 2004, 16:31
Here an example of a bom. (bmp file) and the zip file with the icons used
Xikkos
30th September 2004, 21:29
Hi,
How can I read the files that are include in the file bsegif.zip ? For exemple the file "Thumbs.db".
Xikkos.
pconde
1st October 2004, 15:49
Hello,
you can edit them with baan (session ttdsk6200m000) or copy them to windows and use paint
Regards
Philippe
jroberts
6th October 2004, 16:52
Thanks so much for this post,
Our Engineering Staff have been asking for a tool like this for a long time, and I had no idea of how to meet their requirement.
I am deploying it today, and early feedback says that this will be a very valuable tool for us.
Thank you for sharing your knowledge, and for helping me to solve a very real problem in an elegant fashion.
John.
Juergen
7th October 2004, 16:12
Hello Philippe,
respect for this nice and very useful code!
Thanks for your posting,
Juergen
Juergen
11th October 2004, 13:03
Hello Philippe,
do you have any idea why on our system the item descriptions will not be displayed?
I have checked it with the debugger. The field gbf_desc is filled correctly with the descriptions, but only the first 30 characters for field gbf_desc will be displayed (the description starts at position 31).
Thanks in advance,
Juergen
pconde
11th October 2004, 14:49
Hello,
I checked my code, (i have do some update therein since the initial post) I think that the problem is is the routine init_data_gbf.
here is the correct code
retval = gbf.set.key.desc.length(60, 60)
LogExecErrorReturn(retval, "gbf.set.key.desc.length(%d, %d)",
60, 60)
Regards
Philippe Conde
Juergen
11th October 2004, 15:14
problem solved!
thanks for your quick respone.
Regards,
Juergen
mr_suleyman
8th September 2006, 09:31
Hi Dear Friends,
We use Baan IV C3 and I couldn't find those include files. How can I get them ? and
Does it works for c3 version.
Thanks...
pconde
18th September 2006, 14:40
Hello,
On my system (BIV c4) the 2 includes are also present in BIV c1, so I think that it should wotk in c3. The include files can be asked to SSA support.
Regards
Philippe
mr_suleyman
18th September 2006, 15:45
Thanks I solved the problem . Only How can I print GBF ?
pconde
18th September 2006, 17:15
Print GBF. Good question! tggbfsrvlib doesn't include a print function. But I think that it should be possible because in the DEM they print something that like to a gbf tree.
Maybe a bic_info6.1 on all libraries in tgeis or tgbrg could give info?
Regards
Philippe
bdittmar
22nd September 2006, 17:20
Print GBF. Good question! tggbfsrvlib doesn't include a print function. But I think that it should be possible because in the DEM they print something that like to a gbf tree.
Maybe a bic_info6.1 on all libraries in tgeis or tgbrg could give info?
Regards
Philippe
Hello,
it's posible to print the gbf tree as pure ascii tree.
Regards
mr_suleyman
22nd September 2006, 17:55
I couldn't find this object (Baan IV c3) . I search my sistem I got only followings files.
$
/baan/bse/lib/printinf
/baan/bse/application/tgB40_c1/otgbrg/obrggprint
/baan/bse/application/tgB40_c1/otgbrg/obrgprint
/baan/bse/application/tgB40U_c4_stnd/otgbrg/obrggprint
/baan/bse/application/tgB40_c3/otgbrg/obrggprint
/baan/bse/application/tgB40U_c3_stnd/otgbrg/obrgprint
/baan/bse/application/tgB40U_c3_stnd/otgbrg/obrggprint
/baan/bse/application/tgB40_c4/otgbrg/obrggprint
/baan/bse/application/tgB40_c4/otgbrg/obrgprint
/baan/bse/tools/ttB40_c4/ottstp/ostpprofprint
/baan/bse/tools/ttB40_c4/ottdll/odllprintscr
/baan/bse/include6.1/bic_gprint
/baan/bse/include6.1/bic_gprinth
/baan/bse/include6.1/bic_print
/baan/bse/tools_220404/ttB40_c4/ottstp/ostpprofprint
/baan/bse/tools_220404/ttB40_c4/ottdll/odllprintscr
/baan/bse/include6.1_220404/bic_gprint
/baan/bse/include6.1_220404/bic_gprinth
/baan/bse/include6.1_220404/bic_print
That is all.
bdittmar
23rd September 2006, 16:13
I couldn't find this object (Baan IV c3) . I search my sistem I got only followings files.
That is all.
Hello,
look at this thread.
http://www.baanboard.com/baanboard/showthread.php?t=28160
It's my own DLL, so can't find it in your system.
Regards
skorc123
20th November 2006, 14:42
what seems to be the problem?
see attachement
thank you for your reply, Zoran
skorc123
20th November 2006, 15:51
never mind, got it working.
Thank you for the code.
skorc123
21st November 2006, 14:54
Hi, loved your post on gbf for BOM.
Could you tell me how can I make my top level item (the search item) to be the first node. See attachement.
item 229285 to become top node
Thank you
bdittmar
21st November 2006, 18:32
Hi, loved your post on gbf for BOM.
Could you tell me how can I make my top level item (the search item) to be the first node. See attachement.
item 229285 to become top node
Thank you
Hello,
do you have function for top level ?
function extern long gbf.get.top.level()
{
long act.set
string gbf.desc.tl(100)
gbf.desc.tl = ""
act.set = int.iconset2
head_key(1;3) = " "
head_key(4;6) = cprj.f(1;6)
head_key(10;16) = mitm.f(1;16)
if isspace(cprj.f) then
act.set = int.iconset1
endif
if not isspace(cprj.f) then
select tipcs021.*
from tipcs021
where tipcs021._index1 = {:cprj.f, :mitm.f}
selectdo
endselect
gbf.desc.tl(5)= ADJUST.ITEM(tipcs021.item,tipcs021.cprj)&"-"&strip$(shiftl$(tipcs021.dsca)) & "-" &
strip$(edit$(tipcs021.unom,"ZZ9VD9999")) & " " & tipcs021.cuni
else
select tiitm001.*
from tiitm001
where tiitm001._index1 = {:mitm.f}
selectdo
endselect
gbf.desc.tl(4)= ADJUST.ITEM(tiitm001.item)&"-"&strip$(shiftl$(tiitm001.dsca))&"-"&edit$(tiitm001.unom,"ZZ9VD9999") &
" " & tiitm001.cuni
endif
rc = gbf.add.object(head_key,
strip$(shiftl$(gbf.desc.tl)),
1,
false,
act.set,
0,
0,
0,
0,
rgb.black)
return(0)
}
Regards
skorc123
22nd November 2006, 13:54
Thanks, did it, had top level, just didn't write the way it should be.
Can anyone tell me if there is a way to perform any action/function/session after doubleclicking leaf in tree structure, i've debugged it but nothing seems to happen after double-clickind the leaf.
Thank you
bdittmar
22nd November 2006, 15:04
Thanks, did it, had top level, just didn't write the way it should be.
Can anyone tell me if there is a way to perform any action/function/session after doubleclicking leaf in tree structure, i've debugged it but nothing seems to happen after double-clickind the leaf.
Thank you
Hello,
yes it is possible with logic in :
function extern long gbf.menu.selected( long obj.id, const string object.key(), long object.value, long menu.option)
for example .
zoom.to$("dhitm0501m001",z.session,prog.name$,"",0)
#pragma used session dhitm0501m001
I've added some screendumps, to show what is posible !
Regards
skorc123
23rd November 2006, 11:19
Hey bditmar,
if posible could you post code where you define custom buttons and assign icons to it and how you call various functions.
entire code would be better.
I am new to Baan, only month and a half and therefor I am still having troubles with it. i am doing my best :)
I appologies if I went too far with the request about posting entire code.
You can mail it to zoran.skorc@email.si if preferable.
Thank you, Zoran
bdittmar
23rd November 2006, 20:17
Hey bditmar,
if posible could you post code where you define custom buttons and assign icons to it and how you call various functions.
entire code would be better.
I am new to Baan, only month and a half and therefor I am still having troubles with it. i am doing my best :)
I appologies if I went too far with the request about posting entire code.
You can mail it to zoran.skorc@email.si if preferable.
Thank you, Zoran
Hello Zoran,
after 6 weeks in BaaN - Tools such a project ?
The shown possible functions are built in an own Module.
My employer is owner of the code, so i'm able to give you some ideas for your own concept, but not the entire code, functions, graphics a.s.o.
Regards
skorc123
24th November 2006, 10:45
You all already did a lot, thank you for all your replays and posts.
I learned so much from you guys in this month and a half.
Have a nice day bdittmar and thanks again for your help
Regards, Zoran
skorc123
24th November 2006, 10:48
Hello Zoran,
after 6 weeks in BaaN - Tools such a project ?
The shown possible functions are built in an own Module.
My employer is owner of the code, so i'm able to give you some ideas for your own concept, but not the entire code, functions, graphics a.s.o.
Regards
I have been working as a developer for a company that developed its own ERP (VisualStudio, Borland), it's just that Baan is a little diffrent and i have to get used to it.
Besides the bigger the challenge the better
Regards
mr_suleyman
24th November 2006, 13:14
If you evaluate the source of GBF, it is really enough for your other wishes.
And you should have little baan programming logic.
Good luck !
solepeder
27th November 2006, 19:50
I think the problem is that the libraries tggbfsvrlib and tgcomlogging weren't added to the script.
Try adding these libraries.
Good Luck..
Soledad
solepeder
27th November 2006, 20:00
I think the problem is that the libraries tggbfsvrlib and tgcomlogging weren't added to the script.
Try adding these libraries.
Good Luck..
Soledad
Sorry, I didin't see the rest of the messages... I wanted to answer to:
skorc123 what seems to be the problem?
see attachement
thank you for your reply, Zoran
Fridolin
14th April 2008, 16:14
Hello,
Im just checking out the example of the tree object provided by pconde.
As compilation I receive always the error message indicating that the librairies tggbfsrvlib and tgcomlogging are not found.
I suggest that this librairies are not on my Baan IVc system!
What have I to do to install this livrairies on my system?
Regards
Fridolin
pconde
14th April 2008, 17:40
Hi,
In the script use option libraries to maintain the libraries that the compilation process must use
Regards
Philippe
bdittmar
15th April 2008, 14:43
Hello,
Im just checking out the example of the tree object provided by pconde.
As compilation I receive always the error message indicating that the librairies tggbfsrvlib and tgcomlogging are not found.
I suggest that this librairies are not on my Baan IVc system!
What have I to do to install this livrairies on my system?
Regards
Fridolin
Hello Fridolin,
tggbfsrvlib and tgcomlogging are standard libs from 1998, so i can not understand that these libs are not on your system ?
Have a look at my attachment.
Regards
moianix
28th May 2008, 16:04
Hi to all.
i want to add other menu with functions ( i.e. run a baan prgram )
in a GBF screen ( Baan IV c4 ).
How can i do it ?
Thx
pconde
29th May 2008, 12:28
Hi here an example with function linked to menu
See code marked PCE 2 and variable hwnd.func
|******************************************************************************
|* spbom0719 0 VRC B40O c4 expl
|* Impression graphique Nomenclatures spécifiques
|* Philippe Condé
|* 2004-08-16
|
|* PCE2, Philippe Conde
|* add menu option and support dbl click on purchased item(=leaf)
|
|* PCE 3 Philippe Conde, 2004-10-07, B40O_c4_expl
|* add dll for function done for leaf
|
|* PCE 4 Philippe Conde, 2004-11-16, B40O_c4_expl
|* change dll for function add parameter type from screen
|
|******************************************************************************
|* Main table tipcs022 Nomenclatures spécifiques, Form Type 4
|******************************************************************************
|* License :
|* Copyright 2001 by <Philippe Conde>
|*
|* All Rights Reserved
|*
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation.
|*
|* Philippe Conde and Baanboard.com DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL Philippe conde nor Baanboard.com BE LIABLE FOR ANY
|* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|*
|****************************** declaration section ***************************
declaration:
#ident "PCE3, Philippe Conde, 2004-10-07, B40O_c4_expl"
table ttipcs022 |* Nomenclatures spécifiques
table ttcmcs003 |* Magasins
table ttibom010 |* Nomenclatures de fabrication
table ttiitm001 |* Articles
table ttipcs021 |* Articles spécifiques
table tttgfd400
long rc
extern domain tcyesno txta.yn
domain tcmcs.str40 gbf_key
domain tcmcs.str80 gbf_desc
domain tcmcs.str40 head_key
domain tcdate mydate
extern domain tccprj cprj.f fixed
extern domain tcitem mitm.f fixed
extern domain tcdsca dsca.f fixed
extern domain tcmcs.long type.help
long int.iconset1
long int.iconset2
long leaf.iconset1
long leaf.iconset2
long hwnd.func
long menu.id
extern domain tccprj zoom.cprj
extern domain tcitem zoom.item
#include "itggbfdefs" |*
#include "itgcomlogging" |*
|****************************** form section **********************************
form.1:
init.form:
mydate = date.num()
get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:
on.choice:
read.main.table()
|****************************** field section *********************************
field.mitm.f:
check.input:
dsca.f = ""
if isspace(cprj.f) then
select tiitm001.* from tiitm001
where tiitm001._index1 = {:mitm.f}
as set with 1 rows
selectdo
if tiitm001.kitm <> tckitm.manufacture then
set.input.error("spbom07191")
|* Article non fabriqué
else
dsca.f = tiitm001.dsca
endif
selectempty
set.input.error("spbom07192")
|* Article inconnu
endselect
else
select tipcs021.* from tipcs021
where tipcs021._index1={:cprj.f, :mitm.f}
as set with 1 rows
selectdo
if tipcs021.kitm <> tcpuma.manufacture then
set.input.error("spbom07191")
|* Article non fabriqué
else
dsca.f = tipcs021.dsca
endif
selectempty
set.input.error("spbom07192")
|* Article inconnu
endselect
endif
display(dsca.f)
before.zoom:
if isspace(cprj.f) then
attr.zoomsession$ ="tiitm0502s000"
attr.zoomreturn$ = "tiitm001.item"
zoom.item = mitm.f
else
attr.zoomsession$ = "tipcs2522s000"
attr.zoomreturn$ = "tipcs021.item"
tipcs021.cprj = cprj.f
zoom.cprj = cprj.f
endif
|****************************** function section ******************************
functions:
function read.main.table()
{
rc = init_data_gbf()
}
function long read.pcs022( domain tccprj mycprj, domain tcitem myitem )
{
select tipcs022.* from tipcs022
where tipcs022._index1 = {:mycprj, :myitem}
order by tipcs022._index1
selectdo
gbf_key(1;3) = edit$(tipcs022.pono,"999")
gbf_key(10;16) = tipcs022.sitm(1;16)
gbf_key(4;6) = " "
gbf_desc(1;3)=edit$(tipcs022.pono,"999")
gbf_desc(4;1) = " "
gbf_desc(5;6)=" "
gbf_desc(11;2) = " "
gbf_desc(13;16)=tipcs022.sitm(1;16)
gbf_desc(29;2)=" "
gbf_desc(31;10) = edit$(tipcs022.qana, "ZZZZ9.VD999")
gbf_desc(41;4)=" #"
if tipcs022.opol = tcittb.customized then
gbf_desc(5;6) = tipcs022.cprj(1;6)
gbf_key(4;6) = tipcs022.cprj(1;6)
select tipcs021.* from tipcs021
where tipcs021._index1 = {:mycprj, :tipcs022.sitm}
as set with 1 rows
selectdo
gbf_desc(45;30)=tipcs021.dsca(1;30)
if tipcs021.kitm = tcpuma.manufacture then
rc = gbf.add.interior(gbf_key, gbf_desc, 1) |node
else
|PCE2.o rc = gbf.add.object(gbf_key, gbf_desc, 2, true, leaf.iconset2) |leaf
rc = gbf.add.object(gbf_key, gbf_desc, 2,
true, leaf.iconset2, hwnd.func) |leaf
endif
endselect
else
select tiitm001.* from tiitm001
where tiitm001._index1= {:tipcs022.sitm}
as set with 1 rows
selectdo
gbf_desc(45;30) = tiitm001.dsca(1;30)
if tiitm001.kitm = tckitm.manufacture then
rc = gbf.add.object(gbf_key, gbf_desc, 1,
false, int.iconset2) | node
else
|#PCE2.o rc = gbf.add.object(gbf_key, gbf_desc, 2, true, leaf.iconset1) |leaf
rc = gbf.add.object(gbf_key, gbf_desc, 2,
true, leaf.iconset1, hwnd.func) |#PCE2.n
endif
endselect
endif
endselect
return(0)
}
function long read.bom010(domain tcitem myitem)
{
select tibom010.*
from tibom010
where tibom010._index1 inrange {:myitem, 0}
and {:myitem, 999}
and (tibom010.exdt = 0 or
tibom010.exdt > :mydate )
order by tibom010._index1
selectdo
gbf_key(1;3) = edit$(tibom010.pono,"999")
gbf_key(4;6) = " "
gbf_key(10;16) = tibom010.sitm(1;16)
gbf_desc(1;3)=edit$(tibom010.pono,"999")
gbf_desc(4;1) = " "
gbf_desc(5;6)=" "
gbf_desc(11;2) = " "
gbf_desc(13;16)=tibom010.sitm(1;16)
gbf_desc(29;2)=" "
gbf_desc(31;10) = edit$(tibom010.qana, "ZZZZ9.VD999")
gbf_desc(41;4)=" #"
select tiitm001.* from tiitm001
where tiitm001._index1 = {:tibom010.sitm}
as set with 1 rows
selectdo
gbf_desc(45;30) = tiitm001.dsca(1;30)
if tiitm001.kitm = tckitm.manufacture then
rc = gbf.add.object(gbf_key, gbf_desc, 1,
false, int.iconset2) |node
else
|#PCE2.o rc = gbf.add.object(gbf_key, gbf_desc, 2, true, leaf.iconset1) |leaf
rc = gbf.add.object(gbf_key, gbf_desc, 2,
true, leaf.iconset1, hwnd.func) |#PCE2.n
endif
endselect
endselect
return(0)
}
function extern long init_data_gbf()
{
long font.def(10), mwin1
long def.options
long ret_start
long retval
head_key(1;10) =form.text$("spbom07196")
|* Article
head_key(10;6) = cprj.f(1;6)
head_key(20;16) = mitm.f(1;16)
def.options = GBF.OPT.DEFAULT + GBF.OPT.DEBUG |+ GBF.OPT.UNSELECT
| retval = gbf.init(gbf.current.library(), head_key,
| bit.or(GBF.MENU.ALL , GBF.MENU.FILE.OPEN),
| bit.or(GBF.BUTTON.ALL, GBF.BUTTON.FILE.QUIT),
| def.options)
retval = gbf.init(gbf.current.library(), head_key,
GBF.MENU.ALL, GBF.BUTTON.ALL, def.options)
LogExecErrorReturn(retval, "gbf.init()")
int.iconset1 = gbf.set.interior.icon( "bom",
"specm.normal", |unselected.closed
"specm.open", |unselected.open
"specm.closed", |selected.closed
"specm.open", |selected.open
true ) |Défault
int.iconset2 = gbf.set.interior.icon( "bom",
"standm.normal", |unselected.closed
"standm.normal", |unselected.open
"standm.select", |selected.closed
"standm.select", |selected.open
false )
leaf.iconset1 = gbf.set.leaf.icon( "bom",
"purs.normal",
"purs.select",
TRUE)
leaf.iconset2 = gbf.set.leaf.icon( "bom",
"pursp.normal",
"pursp.select",
false)
| rc = gbf.get.resource(DsNfontset, dummy )
mwin1 = current.mwindow()
| obj_id = create.object(DsCfontSet, mwin1, font.def)
| rc = gbf.set.resource(DsNfontset, dummy )
retval = gbf.set.key.desc.length(40, 80)
LogExecErrorReturn(retval, "gbf.set.key.desc.length(%d, %d)",
40, 80)
retval = gbf.set.sort.strategy( GBF.SORT.DESC
+ GBF.SORT.ASCENDING
+ GBF.SORT.INSENSITIVE)
LogExecError(retval, "gbf.set.sort.strategy()")
retval = gbf.set.open.strategy( GBF.OPEN.AGAIN
+ GBF.OPEN.CURSEL
+ GBF.OPEN.READALL)
LogExecError(retval, "gbf.set.open.strategy()")
|#PCE2.sn 1. Create menu
| 2. add function linked to menu
| 3. add item menu linked to menu and to fucntion
menu.id = gbf.set.menu.head(form.text$("spbom07194"), 0,0)
|* Nomenclature
hwnd.func = gbf.set.menu.function(gbf.current.library(), "myfunc.leaf", TRUE ) | only for leaf
rc = gbf.set.menu.item( menu.id, form.text$("spbom07195"),"",true, hwnd.func, 0 ,0)
|* Detail stock & Prix
|#PCE2.en
ret_start = gbf.start(1, 1)
return (0)
}
function long find.bom(const string key.c())
{
long retval
domain tcitem item.c
domain tccprj cprj.c
cprj.c = key.c(4;6)
item.c = key.c(10;16)
if isspace(cprj.c) then
retval = read.bom010(item.c)
else
retval = read.pcs022(cprj.c,item.c)
endif
return (0)
}
|************************************************************************
|* call back function : is called in tggbfsrvlib
|************************************************************************
function extern long gbf.get.top.level()
{
head_key(1;3) = " "
head_key(4;6) = cprj.f(1;6)
head_key(10;16) = mitm.f(1;16)
return (find.bom(head_key))
}
|************************************************************************
|* call back function : is called in tggbfsrvlib
|************************************************************************
function extern long gbf.get.children(const string key(),
long value,
long level)
{
return (find.bom(key))
}
|************************************************************************
|* call back function : is called in tggbfsrvlib
|************************************************************************
function extern long gbf.save(
const long object.id,
const string object.key(),
const long object.value,
const long menu.value)
{
| Doesn't need save already in tables :-)
return (0)
}
|#PCE2.sn
|************************************************************************
|* call back function : would be called in tggbfsrvlib (Not working)
|************************************************************************
function extern long gbf.menu.selected(
const long object.id,
const string object.key(),
const long object.value,
const long menu.value)
{
rc = gbf.set.label1("BOM")
return (0)
}
|************************************************************************
|* call back function : is called in tggbfsrvlib
|* back here if a) line selected and
|* b) help on this item
|************************************************************************
function extern long gbf.help.selected(
const long object.id,
const string object.key(),
const long object.value,
const long help.type)
{
domain tcitem item.l |#PCE3.n
domain tccprj cprj.l |#PCE3.n
if not isspace(object.key) then
|#PCE3.sn
cprj.l = object.key(4;6)
item.l = object.key(10;16)
message(spbom.dll0719.item.mess(cprj.l, item.l,type.help))
|#PCE3.en
endif
return (0)
}
|#PCE3.so
|function string spbom0719.item.mess(const string key.l())
|{
| if isspace(cprj.l) then
| select tiitm001.* from tiitm001
| where tiitm001._index1 = {:item.l}
| as set with 1 rows
| selectdo
| if tiitm001.kitm = tckitm.manufacture then
| return( sprintf$(form.text$("spbom07193"),
| |* Stock = %d \n Prix = %d \n Poids = %d
| tiitm001.stoc, tiitm001.copr, tiitm001.wght))
| else
| return( sprintf$(form.text$("spbom07193"),
| |* Stock = %d \n Prix = %d \n Poids = %d
|- tiitm001.stoc, tiitm001.avpr, tiitm001.wght))
| endif
| endselect
| else
| select tipcs021.* from tipcs021
| where tipcs021._index1 = {:cprj.l, :item.l}
| as set with 1 rows
| selectdo
|- return( sprintf$(form.text$("spbom07193"),
| |* Stock = %d \n Prix = %d \n Poids = %d
| tipcs021.stoc, tipcs021.cpra, tipcs021.wght))
| endselect
| endif
| return("No message")
|}
|#PCE3.eo
function extern long myfunc.leaf(const long obj.id,
const string obj.key(),
const long obj.value,
const long obj.menu)
{
domain tcitem item.l |#PCE3.n
domain tccprj cprj.l |#PCE3.n
if not isspace(obj.key) then
|#PCE3.sn
cprj.l = obj.key(4;6)
item.l = obj.key(10;16)
message(spbom.dll0719.item.mess(cprj.l, item.l,type.help))
|#PCE3.en
|#PCE3.o message(spbom0719.item.mess(obj.key))
endif
return(0)
}
|#PCE2.en
moianix
29th May 2008, 12:58
Hi Philippe or Bonjour Philippe
thx for your quick reply ...
i solved in another way ... surely is not the best ... but it run
Now i have another problem ... how can i refresh GBF screen when i cange something on BOM data ? see the markup "Question"
Thx for your help.
Best regards from Italy
function extern long init_data_gbf()
{
long def.options
long ret_start
head_key(1;16) = mitm.f(1;16)
retval = gbf.init(gbf.current.library(), head_key,
bit.or(GBF.MENU.ALL , GBF.MENU.FILE.OPEN),
bit.or(GBF.BUTTON.ALL, GBF.BUTTON.FILE.QUIT),
def.options)
LogExecErrorReturn(retval, "gbf.init()")
int.iconset1 = gbf.set.interior.icon( "bom",
"specm.normal", |unselected.closed
"specm.open", |unselected.open
"specm.closed", |selected.closed
"specm.open", |selected.open
true ) |Défault
int.iconset2 = gbf.set.interior.icon( "bom",
"standm.normal", |unselected.closed
"standm.normal", |unselected.open
"standm.select", |selected.closed
"standm.select", |selected.open
false )
int.iconset3 = gbf.set.interior.icon( "bom",
"ghost.normal", |unselected.closed
"ghost.normal", |unselected.open
"ghost.select", |selected.closed
"ghost.select", |selected.open
false )
leaf.iconset1 = gbf.set.leaf.icon( "bom",
"purs.normal",
"purs.select",
TRUE)
leaf.iconset2 = gbf.set.leaf.icon( "bom",
"pursp.normal",
"pursp.select",
false)
retval = gbf.set.key.desc.length(60, 60)
LogExecErrorReturn(retval, "gbf.set.key.desc.length(%d, %d)",60, 60)
retval = gbf.set.sort.strategy( GBF.SORT.DESC
+ GBF.SORT.ASCENDING
+ GBF.SORT.INSENSITIVE)
LogExecError(retval, "gbf.set.sort.strategy()")
retval = gbf.set.open.strategy( GBF.OPEN.AGAIN
+ GBF.OPEN.CURSEL
+ GBF.OPEN.READALL)
LogExecError(retval, "gbf.set.open.strategy()")
|--- Custom menu
|-- Title
menu.text = "Action"
menu.id = gbf.set.menu.head(menu.text,0,GBF.ZERO.DISABLE)
LogExecError(menu.id, "gbf.set.menu.head()")
|-- Menu selection
menu.text = "Maintain Item Data"
keystroke = ""
set.menu.item()
menu.text = "Maintain BOM Data"
keystroke = ""
set.menu.item()
|*******
ret_start = gbf.start(1, 1)
return (0)
}
function set.menu.item()
{
retval = gbf.set.menu.item(menu.id,menu.text,keystroke,0,menu.function.id,0,GBF.ZERO.DISABLE)
LogExecError(retval, "gbf.set.menu.item()")
}
|--- Action selected
function extern long gbf.menu.selected( long obj.id,
const string object.key(),
long object.value,
long menu.option)
{
|--- Value of menu.option
| 41 = "Maintain Item Data"
| 42 = "Maintain BOM Data"
ON CASE menu.option
CASE 41:
zoom.item = object.key(4;16)
export("zoom.item",zoom.item)
zoom.to$("tppdm0110s000",z.session,prog.name$,"",0)
break
CASE 42:
zoom.item = object.key(4;16)
export("zoom.item",zoom.item)
zoom.to$("tibom1110s000",z.session,prog.name$,"",0)
|***Question
|How to refresh data ????? init_data_gbf()
break
DEFAULT:
message("Invalid selection")
ENDCASE
return (0)
}
pconde
29th May 2008, 14:46
Hello,
I think that this is not so easy because the GBF tree is in memory and it is not refreshed.
It is the same problem as when you change a menu in the browser. If the menu was displayed in your browser before the change you can only see the change after exit bw and reload it.
So I have 2 ideas
a) redo a gbf.init and reload all.
b) use function gbf.delete.object + gbf.add.object
not sure that this should do the trick.
Regards
Philippe
moianix
29th May 2008, 15:23
Hello
i go to try your ideas.
Thx.
ctarton1
6th March 2010, 22:00
Hi Philippe or Bonjour Philippe
thx for your quick reply ...
i solved in another way ... surely is not the best ... but it run
Now i have another problem ... how can i refresh GBF screen when i cange something on BOM data ? see the markup "Question"
Thx for your help.
Best regards from Italy
function extern long init_data_gbf()
{
long def.options
long ret_start
head_key(1;16) = mitm.f(1;16)
retval = gbf.init(gbf.current.library(), head_key,
bit.or(GBF.MENU.ALL , GBF.MENU.FILE.OPEN),
bit.or(GBF.BUTTON.ALL, GBF.BUTTON.FILE.QUIT),
def.options)
LogExecErrorReturn(retval, "gbf.init()")
int.iconset1 = gbf.set.interior.icon( "bom",
"specm.normal", |unselected.closed
"specm.open", |unselected.open
"specm.closed", |selected.closed
"specm.open", |selected.open
true ) |Défault
int.iconset2 = gbf.set.interior.icon( "bom",
"standm.normal", |unselected.closed
"standm.normal", |unselected.open
"standm.select", |selected.closed
"standm.select", |selected.open
false )
int.iconset3 = gbf.set.interior.icon( "bom",
"ghost.normal", |unselected.closed
"ghost.normal", |unselected.open
"ghost.select", |selected.closed
"ghost.select", |selected.open
false )
leaf.iconset1 = gbf.set.leaf.icon( "bom",
"purs.normal",
"purs.select",
TRUE)
leaf.iconset2 = gbf.set.leaf.icon( "bom",
"pursp.normal",
"pursp.select",
false)
retval = gbf.set.key.desc.length(60, 60)
LogExecErrorReturn(retval, "gbf.set.key.desc.length(%d, %d)",60, 60)
retval = gbf.set.sort.strategy( GBF.SORT.DESC
+ GBF.SORT.ASCENDING
+ GBF.SORT.INSENSITIVE)
LogExecError(retval, "gbf.set.sort.strategy()")
retval = gbf.set.open.strategy( GBF.OPEN.AGAIN
+ GBF.OPEN.CURSEL
+ GBF.OPEN.READALL)
LogExecError(retval, "gbf.set.open.strategy()")
|--- Custom menu
|-- Title
menu.text = "Action"
menu.id = gbf.set.menu.head(menu.text,0,GBF.ZERO.DISABLE)
LogExecError(menu.id, "gbf.set.menu.head()")
|-- Menu selection
menu.text = "Maintain Item Data"
keystroke = ""
set.menu.item()
menu.text = "Maintain BOM Data"
keystroke = ""
set.menu.item()
|*******
ret_start = gbf.start(1, 1)
return (0)
}
function set.menu.item()
{
retval = gbf.set.menu.item(menu.id,menu.text,keystroke,0,menu.function.id,0,GBF.ZERO.DISABLE)
LogExecError(retval, "gbf.set.menu.item()")
}
|--- Action selected
function extern long gbf.menu.selected( long obj.id,
const string object.key(),
long object.value,
long menu.option)
{
|--- Value of menu.option
| 41 = "Maintain Item Data"
| 42 = "Maintain BOM Data"
ON CASE menu.option
CASE 41:
zoom.item = object.key(4;16)
export("zoom.item",zoom.item)
zoom.to$("tppdm0110s000",z.session,prog.name$,"",0)
break
CASE 42:
zoom.item = object.key(4;16)
export("zoom.item",zoom.item)
zoom.to$("tibom1110s000",z.session,prog.name$,"",0)
|***Question
|How to refresh data ????? init_data_gbf()
break
DEFAULT:
message("Invalid selection")
ENDCASE
return (0)
}
Hello,
for refresh data in the tree try to use this function:
function refresh.F5()
{
long event_2(EVTMAXSIZE)
evt.type(event_2) = EVTKEYPRESS
evt.keypress.key(event_2) = FKEY(5)
send.event(get.pgrp(PID), event_2)
}