mark_h
14th October 2010, 14:57
Sorry to say could not find anything on the board for 4c4, i just recall it was different. I did get this sample provided by baan to work on our system. Don't know if it helps, but here you go.
#include <bic_event>
#include <bic_gc>
#include <bic_gpart>
#include <bic_process>
#include <bic_window>
#include <bic_menu>
#include <bic_object>
#include <bic_key>
#define MAXWIDTH 600
#define MAXHEIGHT 500
#define ABORT.MENU 10
#define END.MENU 11
#define END.BUTTON 20
#define ABORT.BUTTON 21
#define motif.blue RGB(0x78,0xa9,0xff)
long toplevel
long cmap(256)
long cmap_sz
string imap(1) based
long icon_w
long icon_h
long valid.icon
function main()
{
show.mwindow()
fill.work.area()
view.gwindow()
handle.event.loop()
destroy.objects()
}
function long create.old.style.menu(long mwin)
{
long barmenu, pdmenu1, pdmenu2
long casbutt1, casbutt2
long nop
barmenu = create.object(DsCbarMenu, mwin,
DsNsetState, DSRAISE)
pdmenu1 = create.object(DsCpulldownMenu, barmenu)
casbutt1 = create.sub.object(barmenu, DsCcascadeButton,
DsNsubmenu, pdmenu1,
DsNname, "File")
nop = create.sub.object(pdmenu1, DsCmenubutton,
DsNname, "Abort",
DsNreturnValue, ABORT.MENU)
nop = create.sub.object(pdmenu1, DsCmenubutton,
DsNname, "Exit",
DsNreturnValue, END.MENU)
pdmenu2 = create.object(DsCpulldownMenu, barmenu)
casbutt2 = create.sub.object(barmenu, DsCcascadeButton,
DsNsubmenu, pdmenu2,
DsNname, "View")
nop = create.sub.object(pdmenu2, DsCmenubutton,
DsNname, "First")
nop = create.sub.object(pdmenu2, DsCmenubutton,
DsNname, "Last")
nop = create.sub.object(pdmenu2, DsCmenubutton,
DsNname, "Prev")
nop = create.sub.object(pdmenu2, DsCmenubutton,
DsNname, "Next")
return(barmenu)
}
function long create.new.style.menu(long mwin)
{
long barmenu, size
string menudata(1) based
alloc.mem(menudata, 3000)
size = 1
| write header info to buffer
store.long(1, menudata(size)) | version is 1
size = size + 4
store.long(8, menudata(size)) | menu contains 8 entries
size = size + 4
| create the File submenu
write.menu.entry(menudata, size, 1, 0, "&File", 0)
write.menu.entry(menudata, size, 2, ABORT.MENU, "Abort", 0)
write.menu.entry(menudata, size, 2, END.MENU, "E&xit Alt+F4", 0)
| create the View submenu
write.menu.entry(menudata, size, 1, 0, "&View", 0)
write.menu.entry(menudata, size, 2, 30, "First", 0)
write.menu.entry(menudata, size, 2, 31, "Last", 0)
write.menu.entry(menudata, size, 2, -1, "-", 0) | separator
write.menu.entry(menudata, size, 2, 32, "Prev", 0)
write.menu.entry(menudata, size, 2, 33, "Next", 0)
barmenu = create.object(DsCbarMenu, mwin,
DsNmenuData, menudata, size-1,
DsNsetState, DSRAISE)
return(barmenu)
}
function write.menu.entry(ref string menudata(), ref long size,
long level, long id, const string name(), long flags)
{
store.long(level, menudata(size))
size = size + 4
store.long(id, menudata(size))
size = size + 4
menudata(size) = name
size = size + len(name)
store.byte(0, menudata(size)) | terminate string with 0 char.
size = size + 1
store.long(flags, menudata(size))
size = size + 4
}
function show.mwindow()
{
long flags, server.data(9)
long barmenu, butt1, butt2
long rowcol
flags = DSSTATUSOFF + DSBUTTONBAROFF + DSNORMALSTATE + DSIGNOREINTERRUPT
toplevel = create.object( DsCmwindow, current.mwindow(),
DsNtitle, "MWindow",
DsNprocessgroup, get.pgrp(pid),
DsNbackground, RGB.BLACK,
DsNx, 10,
DsNy, 10,
DsNminWidth, 500,
DsNminHeight, 400,
DsNmaxWidth, MAXWIDTH,
DsNmaxHeight, MAXHEIGHT,
DsNmode, DSPIXELBASED,
DsNflags, flags )
get.display.data(server.data)
if srv.type(server.data) = DSBW then
barmenu = create.new.style.menu(toplevel)
else
barmenu = create.old.style.menu(toplevel)
endif
change.object( toplevel,
DsNbarMenu, barmenu )
rowcol = create.object(DsCrowColumn, toplevel,
DsNbackground, motif.blue,
DsNpacking, DSPACKNONE,
DsNborderWidth, 0,
DsNnumRows, 1,
DsNnumColumns, 5,
DsNx, 0,
DsNy, 0,
DsNwidth, 500,
DsNheight, 20,
DsNfixedDimension, DSHORIZONTAL )
butt1 = create.object(DsCpushButton, rowcol,
DsNbackground, motif.blue,
DsNforeground, RGB.BLACK,
DsNstring, "Abort",
DsNx, 0,
DsNy, 0,
DsNreturnValue, ABORT.BUTTON)
butt2 = create.object(DsCpushButton, rowcol,
DsNbackground, motif.blue,
DsNforeground, RGB.BLACK,
DsNstring, "End",
DsNx, 50,
DsNy, 0,
DsNreturnValue, END.BUTTON)
update.object(toplevel)
}
function fill.work.area()
{
long label, combox, listboxitem1, listboxitem2, listboxitem3
long listboxitem4, listboxitem5, listboxitem6
label = create.object(DsClabel, toplevel,
DsNbackground, RGB.BLACK,
DsNforeground, RGB.WHITE,
DsNx, 20,
DsNy, 40,
DsNstring, "Article" )
combox = create.object(DsCdDComBox, toplevel,
DsNbackground, motif.blue,
DsNforeground, RGB.WHITE,
DsNminWidth, 80,
DsNborderColor, RGB.WHITE,
DsNborderWidth, 2,
DsNmaxWindowSize, 25,
DsNspace, 2,
DsNx, 80,
DsNy, 40,
DsNstring, "Combox" )
change.object(combox,
DsNeditable, FALSE)
listboxitem1 = create.sub.object(combox, DsClistBoxItem,
DsNstring, "article1" )
listboxitem2 = create.sub.object(combox, DsClistBoxItem,
DsNstring, "article2" )
listboxitem3 = create.sub.object(combox, DsClistBoxItem,
DsNstring, "article3" )
listboxitem4 = create.sub.object(combox, DsClistBoxItem,
DsNstring, "article4" )
listboxitem5 = create.sub.object(combox, DsClistBoxItem,
DsNstring, "article5" )
listboxitem6 = create.sub.object(combox, DsClistBoxItem,
DsNstring, "article6" )
update.object(toplevel)
}
function view.gwindow()
{
long gc.id, gwin, rect
string file(128)
string bufr(1) based
long buflen, fp, retv
long idc, idp, image
gc.id = create.object(DsCgc, toplevel,
DsNgcBackground, RGB.RED,
DsNgcCapStyle, GCCAPBUTT,
DsNgcLineWidth, 0 )
gwin = create.object(DsCgwindow, toplevel,
DsNbackground, motif.blue,
DsNx, 300,
DsNy, 250,
DsNwidth, 100,
DsNheight, 80,
DsNpointerCursor, DSCHAND,
DsNeventMask, EVTALLEVENTMASK )
rect = create.sub.object(gwin, DsCgpRectangle,
DsNgc, gc.id,
DsNgcBackground, RGB.WHITE,
DsNx, 0,
DsNy, 0,
DsNwidth, 25,
DsNheight, 25 )
file = "${BSE}/gif/desktop.gif/tools1"
fp = seq.open(file, "r")
buflen = seq.seek(0, 2, fp)
alloc.mem(bufr, buflen)
seq.rewind(fp)
seq.read(bufr, buflen, fp)
seq.close(fp)
if get.pixmap.info(bufr, cmap_sz, icon_w, icon_h) then
alloc.mem(imap, icon_w * icon_h)
valid.icon = decompress.pixmap(bufr, cmap, imap)
cmap(1) = rgb(191,191,191)
endif
free.mem(bufr)
idc = create.object(DsCcolormap, current.display(),
DsNcolorTable, cmap, cmap_sz )
idp = create.object(DsCpixmap, current.display(),
DsNcolormap, idc,
DsNwidth, icon_w,
DsNheight, icon_h,
DsNdata, imap, icon_w * icon_h,
DsNdataType, DSPIXMAP8 )
image = create.sub.object(gwin, DsCgpImage,
DsNpixmap, idp,
DsNx, 0,
DsNy, 0 )
update.object(toplevel)
|change_this_picture( cmap, cmap_sz, imap, icon_w, icon_h )
| defined by the user
fp = seq.open(file, "w")
if fp >= 1 then
buflen = 3 * cmap_sz + icon_w * icon_h + 50
alloc.mem(bufr, buflen)
retv = compress.pixmap( cmap, cmap_sz, imap, icon_w, icon_h,
bufr, buflen)
if retv then
seq.write(bufr, buflen, fp)
endif
seq.close(fp)
free.mem(bufr)
endif
free.mem(imap)
}
function handle.event.loop()
{
long event(EVTMAXSIZE)
while TRUE
next.event(event)
on case evt.type(event)
case EVTMENUSELECT:
if ( evt.menu.return(event) = ABORT.MENU OR
evt.menu.return(event) = END.MENU ) then
return
endif
break
case EVTPUSHBUTTON:
if ( evt.button.return(event) = END.BUTTON OR
evt.button.return(event) = ABORT.BUTTON ) then
return
endif
break
default:
break
endcase
endwhile
}
function destroy.objects()
{
destroy.object(toplevel)
}