Baanboard.com

Go Back   Baanboard.com > Forum > Baan SIGs > Code & Utilities

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
37%
Installation Wizard into new VRC
39%
Manual into existing VRC
3%
Manual into new VRC
21%
Total votes: 38

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 17th September 2010, 00:42
ArokLair's Avatar
ArokLair ArokLair is offline
Junior Member
 
Join Date: Apr 2010
Posts: 3
ArokLair is on a distinguished road
Baan: Baan IVc2 - DB: Informix - OS: AIX 6.1
File Browse Server

This is a library i was developed in Baan IV

Code:
|******************************************************************************
|* tudllfilebrows  0  VRC B40c c2 baan
|* File Browser
|* ArokLair
|* 24/08/10 [16:42]
|******************************************************************************
|* Script Type: Library
|******************************************************************************
#define     COMMAND.ACEPTAR     101
#define     COMMAND.CANCELAR    111
#define		SIZE.STRING			250

long     toplevel, listbox, image,label
string path(SIZE.STRING)
long listitems(200)
string retorno(SIZE.STRING)

function extern select.file(string  ruta_servidor(SIZE.STRING), ref string archivo_seleccionado()){
	
	if not isspace(ruta_servidor) then 
		path=ruta_servidor
	else
		path="/home/"&getenv$("LOGNAME")&"/"
	endif
	main_1()
	archivo_seleccionado=retorno
}

function main_1(){
	image = 0
	show.mwindow()
	fill.work.area()
	update.gwindow()
	handle.event.loop()
}
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 long create.pulldown.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, "&Archivo", 0)
		write.menu.entry(menudata, size, 2, -1, "-", 0)      | separator
      write.menu.entry(menudata, size, 2, COMMAND.CANCELAR, "S&alir  Alt+F4", 0)
      barmenu = create.object(DsCbarMenu, mwin,
                  DsNmenuData,   menudata, size-1,
                  DsNsetState,   DSRAISE)
       return(barmenu)
}
function show.mwindow(){
	long barmenu
	|message(str$(get.pgrp(pid)))
	toplevel = create.object(	DsCmwindow, 0,
								DsNtitle,         "File Explorer Baan 1.0 ArokLair ",
								DsNprocessgroup,  get.pgrp(pid),
								|DsNprocessgroup,current.mwindow(),
								DsNmode,         DSPIXELBASED,
								DsNdialog,1,
								DsNmodal,		1,
								DsNminWidth,      400,
								DsNmaxWidth,      800,
								DsNminHeight,     400,
								DsNmaxHeight,     800)
	barmenu = create.pulldown.menu(toplevel)
	change.object(toplevel, DsNbarMenu, barmenu)
	update.object(toplevel)
}
function fill.work.area(){
		long        rowcol,rowcol2
		rowcol = create.object(DsCrowColumn, toplevel,
                DsNvspace,        10,
                DsNhspace,        10,
                DsNnumColumns,     1,
				DsNfixedDimension, DSHORIZONTAL )
		create.object(DsClabel,  rowcol,
							DsNstring, "Seleccione el Archivo a Examinar...")
		label=create.object(DsClabel,  rowcol,
							DsNstring, path)
		listbox=create.object(DsClistBox,rowcol,
							DsNminWidth,350,
							DsNminHeight,15,
							DsNheight,250,
							DsNselectedId,1)
		rowcol2 = create.object(DsCrowColumn, rowcol,
                DsNvspace,        10,
                DsNhspace,        10,
                DsNnumColumns,     2,
                DsNfixedDimension, DSHORIZONTAL )
		create.object(DsCpushButton,  rowcol2,
				DsNstring,        "Aceptar",
				DsNwidth,			100,
				DsNreturnValue,   COMMAND.ACEPTAR)
		create.object(DsCpushButton,  rowcol2,
				DsNstring,        "Cancelar",
				DsNwidth,			100,
				DsNreturnValue,   COMMAND.CANCELAR)
		update.object(toplevel)
		|update.object(gwin)
}
function update.gwindow(){
	| Leer los archivos del directorio
	long fd,rt, size, mode,cont,posno,fc
	string	fname(SIZE.STRING)
	string home(SIZE.STRING)
	cont=1
	
	home = path
	|destroy.sub.object(listbox,)
	|cargar la Raiz
	listitems(1)=create.sub.object(listbox,1,
							DsNitemAttr,1,
							DsNselected,1,
							DsNstring,"..")
	| Recorrer Directorios
	fd=dir.open(home)
	fname = dir.entry(fd, TDIR, rt, size, mode)
	
	while (not isspace(fname))
		posno=pos(fname,".")
		|message(str$(posno))
		if not posno=1 then
			cont=cont+1
			listitems(cont)=create.sub.object(listbox,1,
										DsNitemAttr,cont,
										DsNselected,0,
										DsNstring,fname&"/")
		endif
		fname=dir.entry(fd, TDIR, rt, size, mode)
	endwhile
	fc=dir.close(fd)
	| Recorrer Archivos
	fd=dir.open(home)
	fname = dir.entry(fd, TFILE, rt, size, mode)
	
	while (not isspace(fname))
		posno=pos(fname,".")
		|message(str$(posno))
		if not posno=1 then
			cont=cont+1
			listitems(cont)=create.sub.object(listbox,1,
										DsNitemAttr,cont,
										DsNselected,0,
										DsNstring,fname)
		endif
		fname=dir.entry(fd, TFILE, rt, size, mode)
	endwhile
	
	update.object(toplevel)
}
function doble_clic(string ruta(SIZE.STRING)){
	|Elimar Items 
	long i
	|message("Entro")
	for i = 1 to 200 step 1
		if(listitems(i)<>0) then 
			destroy.sub.object(listbox, listitems(i))
		endif
	endfor
	path=ruta
	|update.object(toplevel)
	update.gwindow()
}
function long isDir(string ruta(SIZE.STRING)){
	long    ret,loc
	long    size, mode, inode, dev, uid, gid, nlink, ctime, atime, mtimel
	string file_name(SIZE.STRING)
	loc=0
	file_name = ruta
	ret = stat.info(file_name,
					size,
					mode,
					inode,
					dev,
					uid,
					gid,
					nlink,
					ctime,
					mtimel,
					atime )
	if ret then
                | stat.info failed, probably file not found
	endif
	if ( S_ISDIR( mode ) ) then
		loc=1
	endif

	return (loc)
}
function string get.parent(string ruta(SIZE.STRING)){
	long rposno
	ruta=ruta(1;len(ruta)-1)
	rposno=rpos(ruta,"/")
	return (ruta(1;rposno))
}
function handle.event.loop(){
 long item,tim.id,click.count,direc

 string fnamel(SIZE.STRING)

 click.count=0
 direc=0
 tim.id = set.timer(1000)
 long event(EVTMAXSIZE)
      while TRUE
            next.event(event)
            on case evt.type(event)
            case EVTMENUSELECT:
					on case evt.menu.return(event)
					
					case COMMAND.CANCELAR:
                        return
					
                  endcase
                  break
            case EVTPUSHBUTTON:
					if (evt.button.return(event) = COMMAND.CANCELAR ) then
                         return
					endif
					if (evt.button.return(event) = COMMAND.ACEPTAR ) then
						get.object(label,DsNstring,fnamel)
						|message(fnamel)
						retorno=fnamel
						return
					endif
					break
			case EVTLISTBOXSELECT:
						if (evt.listbox.item_id(event)=item) then 
							if(click.count=1 ) then 
								get.object(label,DsNstring,fnamel)
								direc=isDir(fnamel)
								if  direc= 1 then
									doble_clic(fnamel)
								endif
								break
							endif
						endif
						if (evt.listbox.item_id(event)=listitems(1)) then
							if(click.count=1 ) then 
								change.object(label,DsNstring,get.parent(path))
								doble_clic(get.parent(path))
							endif
						else
							get.object(listbox,DsNselectedId,item)
							get.sub.object(listbox,item,DsNstring,fnamel)
							change.object(label,DsNstring,path&fnamel)
						endif
						
						update.object(label)					
						click.count=1
						
					break
			case EVTTIMEREVENT:
				click.count=0
                break
			default:
                  break
            endcase
      endwhile
}
Subsession to launch file explorer 3GL

Code:
#pragma used dll otudllfilebrows
string retorno(500)
string tccom9599.path(500)
string tccom9599.field(500)
function main(){
	import("tccom9599.path",tccom9599.path)
	import("tccom9599.field",tccom9599.field)
	|message(tccom9599.field)
	|message(field)
	
	select.file(tccom9599.path,retorno)
	
	export(tccom9599.field,retorno)
	
}
How use in session 4GL
Code:
declaration:
	extern string tccom9599.path(500)
	extern string tccom9599.field(500)
|****************************** form section **********************************
form.1:
	init.form:
		tccom9599.path = "/home/user1/"
		export("tccom9599.path",tccom9599.path)

choice.user.1:
	on.choice:
		tccom9599.field="campo.ruta"
		export("tccom9599.field",tccom9599.field)
		zoom.to$("tccom9599m000", Z.SESSION, "tccur2105m000", "", 0)
		message(campo.ruta)
		display.all()

Last edited by ArokLair : 14th June 2011 at 20:24. Reason: Example to use
Reply With Quote
  #2  
Old 6th April 2011, 11:33
NirajKakodkar's Avatar
NirajKakodkar NirajKakodkar is offline
Guru
 
Join Date: May 2006
Location: Finland
Posts: 339
NirajKakodkar is on a distinguished road
Baan: BAAN4C4 , BAAN 5c , LN - DB: MS SQL SERVER, ORACLE, Informix, HP Unix, AIX - OS: Windows, UNIX
This is cool ...
__________________

Niraj N. S. Kakodkar |Linkedin
Reply With Quote
  #3  
Old 1st August 2014, 16:48
Joy Conner's Avatar
Joy Conner Joy Conner is offline
Guru
 
Join Date: Aug 2001
Posts: 375
Joy Conner is on a distinguished road
Baan: IVc4 - DB: MS SQL - OS: Windows Server 2008 & 2008 R2
Am I reading this right - this creates a UI with windows explore?
Reply With Quote
  #4  
Old 23rd April 2015, 06:18
ArokLair's Avatar
ArokLair ArokLair is offline
Junior Member
 
Join Date: Apr 2010
Posts: 3
ArokLair is on a distinguished road
Baan: Baan IVc2 - DB: Informix - OS: AIX 6.1
Yes this create UI from objects in baan no winows API only Baan Interface.
Reply With Quote
Sponsored Links
  #5  
Old 23rd April 2015, 06:21
ArokLair's Avatar
ArokLair ArokLair is offline
Junior Member
 
Join Date: Apr 2010
Posts: 3
ArokLair is on a distinguished road
Baan: Baan IVc2 - DB: Informix - OS: AIX 6.1
Thank You... ¿One Quuestion its posible install BaanIV c2 into Red Hat Linux Server? Actually have in AIX 6.1. And its possible virtualization this Baan version??
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Question mr_suleyman Tools Development 37 11th November 2016 09:14
Undocumented Functions & Variables george7a Tools Development 81 30th September 2015 12:35
Browse a file on server (windows) Giovanni27 Tools Development 13 3rd April 2010 14:07
bshell received SIGTERM manojsharma Tools Development 11 5th June 2008 10:22
How to print Postcript in landscape orientation heliopaixao Tools Administration & Installation 8 28th July 2006 14:39


All times are GMT +2. The time now is 20:49.


©2001-2017 - Baanboard.com - Baanforums.com