08/09/2002 21:54:54

Benjamí Vidiella Girončs
bvidiell@pie.xtec.es
----------------------------------------------------------------------
Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle IniciaVariables
	system vtipus
	system mtitol
	system mtexte
	system mgrafic
	system mparaula
	system vnumvideo
	system mcarrega
	system vnumsigne
	system vnumdibu	
	system mmester
	sysSuspend=false
end	

to handle enterApplication
	forward
	send reader
end

to handle enterBook
	send IniciaVariables
end	

to handle reader
	state of mainWindow = maximized
	forward
end

to handle menuItemSelected mNom, mAlias
	system mparaula
	sysSuspend=false

	if mAlias = "configurar"
	sysCursor = 4
	send printsetup
	sysCursor = 1
	end if
	
	if mAlias = "impagina"
	start spooler
		print 1 pages 
	end spooler
	end if
	
	
	if mAlias = "imprimir"

		request "Per Imprimir correctament cal haver anat fins el final del text bilíngüe" with "IMPRIMIR" or "ANULˇLAR"
			conditions
			when It is "ANULˇLAR"
			break
			when It is "IMPRIMIR"
	
	sysCursor=4
	hide button "acabar" of this background
	hide button "ajuda" of this background
	hide button "imprimir" of this background
	hide button "frase" of this background
	hide button "seguent" of this background
	hide button "anterior" of this background
	fillColor of this background=white
	start spooler
		go to page "mostra1"
		print 128 pages 
	end spooler
	show button "acabar" of this background
	show button "ajuda" of this background
	show button "imprimir" of this background
	show button "frase" of this background
	show button "seguent" of this background
	show button "anterior" of this background
	sysCursor=1
	end conditions
	end if
	
	if mAlias = "anomenar"
	syscursor = 4
	linkDLL "tbdlg.DLL"
		STRING saveAsDlg(STRING,STRING,STRING,STRING,INT)
	end linkDLL
	filterList = "Fichier exe (*.exe),*.exe,ToolBook (*.tbk),*.tbk"
	get saveAsDlg("Sauvegarder les données sous",null,null,filterList,1)
	save as EXE It, true
	syscursor=1
	end if

	if mAlias = "anterior"
	if this page is not page "mostra1"
	syscursor = 4
	mparaula=mparaula-42
	go to previous page
	
	sysPageScroll= 0,0
	syscursor = 1
	else
	request "És la primera pāgina"
	end
	end	if
	
	if mAlias = "seguent"
	if this page is last page of this background
	request "És la última pāgina"
	else
	if text of recordField para42 is null
	request "No hi ha més pāgines de text"
	else
	syscursor = 4	
	mparaula=mparaula+42
	go to next page

	sysPageScroll= 0,0
	syscursor = 1
	end if
	end if
	end	if
	
	if mAlias = "mixtos"
	if text of recordField "texte" of page "frase" is null 
	go to page "mostra1"
	else
	syscursor=4
	search in recordField "texte" for ","by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordfield "texte" for ")"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordfield "texte" for "("by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordfield "texte" for ";"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordfield "texte" for "-"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
		search in recordfield "texte" for ":"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordfield "texte" for "!"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordfield "texte" for "CRLF"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	
	go to page "mostra1"
	syscursor = 1
	end if
end	
	
	if mAlias = "sortir"
			request "Voleu salvar els canvis per a properes sessions?" with "SI" or "NO" or "ANULˇLAR"
			conditions
			when It is "SI"
			syscursor = 4
			clear text of recordField "titol" of page "FRASE"
			clear text of recordField "texte" of page "FRASE"
			save changes to this book
			send exit
			when It is "NO"
			send exit
			when It is "ANULˇLAR"
			break
			end conditions
	end	if
	
	if mAlias = "salvar"
		save changes to this book
	end		
	
	if mAlias ="anulˇlar"
		send undo
	end if
	
	if mAlias ="retallar"
		send cut	
	end if
	
	if mAlias ="copiar"
		send copy	
	end if
	
	if mAlias ="engantxar"
		send paste	
	end if	

	if mAlias ="normal"
		fontStyle of selectedText = "regular"
	end if
	
	if mAlias ="negreta"
		fontStyle of selectedText = "bold"
	end if
	
	if mAlias ="tipus"
		if selectedText is not null
		send character
		else
		send formatlletra
		end if
	end if
	
	if mAlias = "grafics"
		syscursor = 4
		clear text of RecordField "titol" of page "FRASE"
		clear text of RecordField "texte" of page "FRASE"
		go to page "gestio"
		syscursor = 1
	end if
	
	if mAlias = "frases"
		syscursor = 4
		go to page "FRASE"
		syscursor = 1
	end if	
	
	if mAlias= "text"
	system sLastResPlayed
	linkDll "tbdlg.dll"
		STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
	end linkDll
	
	strCaption = "Importar un text"
	strFilterList = ""
	
	push "Tots els fitxers (*.*),*.*" onto strFilterList
	push "TXT(.Txt),*.txt" onto strFilterList
	get OpenFileDlg(strCaption,"","",strFilterList,1)
	if (it is not null)
	dades=It
	OpenFile dades
	readFile dades for 20000
	closeFile dades
	dades=it
	put space & It after text of recordField "texte" of page "frase"
	closeFile dades
	end if
	end	if
	
	if mAlias = "Ajuda"
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
	end if
	
	if mAlias = "Autor"
	sysCursor = 4
	show viewer "autor"
	sysCursor = 1
	end if
	
	if mAlias = "cola"
	sysCursor = 4
	show viewer "colabora"
	sysCursor = 1
	end if
	
	if mAlias = "materia"
	sysCursor = 4
	show viewer "materia"
	sysCursor = 1
	end if
	
	if mAlias = "conjuverbs"
	sysCursor = 4
	go to page "verb"
	sysCursor = 1
	end if
	
	if mAlias = "aliments"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "animals"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "casa"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "colors"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "cos"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "diners"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "discapacitats"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "eines"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "escola"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "esports"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if


	if mAlias = "festa"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "geografia"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "gramatica"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "historia"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	
	if mAlias = "matematiques"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "natura"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "persones"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "poble"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "politica"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "religio"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "roba"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "salutacions"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "tecnologia"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "temps"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "verbs"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "altres"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "dactilologia"
	sysCursor = 4
	dades=text of recordField malias of page "categories1" of this book
	clear text of recordField "titol"
	clear text of recordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "noves"
	sysCursor = 4
	dades=text of recordField "llista" of page "categories" of this book
	clear text of recordField "titol"
	clear text of RecordField "texte"
	put malias into text of recordField "titol"
	put space & dades after text of recordField "texte" of page "frase"
	sysCursor = 1
	end if
	
	if mAlias = "cates"
	sysCursor = 4
	go to page "categories"
	sysCursor = 1
	end if
	
	if mAlias = "conficontes"
	sysCursor = 4
	go to page "frase"
	show viewer "histories"
	sysCursor = 1
	end if
	
	if mAlias = "dites"
	syscursor = 4
	clear text of recordField "titol" of page "dites"
	clear text of recordField "texte" of page "dites"
	go to page "dites"
	syscursor = 1
	end
	
	if mAlias = "vocvideo"
	syscursor = 4
	clear text of recordField "titol" of page "vocvideo"
	clear text of recordField "texte" of page "vocvideo"
	go to page "vocvideo"
	syscursor = 1
	end
	
	if mAlias="borrapar"
	syscursor =4
	nombrep=1
	step nombre from 1 to 42
	paraulap="para"&nombrep
	clear text of recordField paraulap of this page
	nombrep=nombrep+1
	end step
	sysCursor=1
	end if

	if mAlias="borrapic"
	sysCursor=4 
	nombrep=1
	step nombre from 1 to 42
	quadrep="parag"&nombrep
	clear text of recordField quadrep of this page
	nombrep=nombrep+1
	end step

	sysCursor=1
	end if
	
	if mAlias = "llegir"
	syscursor=4
	send lectura
	syscursor=1
	end if
	
		
	if mAlias = "film"
	if text of field "item" of this page is null
	request "No heu escrit cap paraula"
	break

	else	
		
	put text of field "item" of this page into un
	un=text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	tres="7"&un
	insert graphic bitmap un after last word of text of RecordField "primerg1" of page "Gestio"
	put un after last word of text of RecordField "primer1" of page "Gestio"
	put text of recordfield "primer1" of this page into vnumsigne
	put tres into vnumdibu
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	

	if text of RecordField "primerg1" of this page is null
	request "No existeix el grāfic" && un && "primer l'haureu de crear"
	sysCursor=1
	break
	else
	

	
	if mmIsOpen of clip un is open then
	
	
	request "S'incorporarā la filmaciķ del signe" && un && "que ha d'estar directori C:\SIGNE2\VIDEOS\" with "SI" or "ANULˇLAR"
	conditions
	
			when It is "ANULˇLAR"
	
			break
		
			when It is "SI"
	
	mmclose all
	remove resource clip un
	mmPlay clip signe2 in stage videos of this page

	linkDll "tbdlg.dll"
	STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
	end linkDll
	strCaption = "Trieu un fitxer grāfic"
	strFilterList = ""
	push "Tots els fitxers (*.*),*.*" onto strFilterList
	push "AVI (*.AVI),*.AVI" onto strFilterList
	get OpenFileDlg(strCaption,"","",strFilterList,1)
	put text of field "item" of this page into un
	if (it is not null)
	sysCursor=4
	mpeli = It
	new clip from mpeli
	name of It = un
	mmOpen clip un
	mmPlay clip un in stage "videos" of this page
	mmSeek clip un to 0
	put tres into vnumdibu
	mmPlay clip vnumdibu in stage "dibuix" of this page
	break
	else
	break
	end if		
	else 
	request "Ja existeix la filmaciķ del signe"&& un && ".Cal eliminar-lo prčviament"
	break
	sysCursor=1
		end conditions
	end if

	end if
		request "Ja existeix la filmaciķ del signe"&& un && ".Cal eliminar-lo prčviament"
	end if
	

end

	if mAlias = "dibuix"

	if text of field "item" of this page is null
	request "No heu escrit cap paraula"
	break

	else	
		
	put text of field "item" of this page into un
	un=text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	tres="7"&un
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page
	put un after last word of text of RecordField "primer1" of this page
	put tres into vnumdibu
	put text of recordfield "primer1" of this page into vnumsigne
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	

	if text of RecordField "primerg1" of this page is null
	request "No existeix el grāfic" && un && "primer l'haureu de crear"
	sysCursor=1
	break
	else

	if mmIsOpen of clip tres is open then

	request "S'incorporarā el dibuix del signe" && un && "que ha d'estar directori C:\SIGNE2\DIBUIX\" with "SI" or "ANULˇLAR"
	conditions
	
			when It is "ANULˇLAR"
	
			break
		
			when It is "SI"
	
	mmclose all
	remove resource clip tres
	mmPlay clip signe2a in stage "dibuix" of this page

	linkDll "tbdlg.dll"
	STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
	end linkDll
	strCaption = "Trieu un fitxer grāfic"
	strFilterList = ""
	push "Tots els fitxers (*.*),*.*" onto strFilterList
	push "Gif (*.GIF),*.GIF" onto strFilterList
	get OpenFileDlg(strCaption,"","",strFilterList,1)
	put text of field "item" of this page into un
	if (it is not null)
	sysCursor=4
	tres="7"&un
	mpeli = It
	new clip from mpeli
	name of It = tres
	mmPlay clip tres in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	break
	else
	
	break
	end if		
	else 
	request "Ja existeix la filmaciķ del signe"&& un && ".Cal eliminar-lo prčviament"
	break
	sysCursor=1
	end conditions
	end if

	end if
		request "Ja existeix la filmaciķ del signe"&& un && ".Cal eliminar-lo prčviament"
	end if
end

	if mAlias="exporsig"
			sysCursor=4
			if text of recordfield "primerg1" is null
			request "No heu seleccionat cap pictograma"
			sysCursor=1
			break
			else
			vmot=text of field "item" of this page
			request "S'exportarā el pictograma" && vmot && "al directori \SIGNE2\ amb el nom EXPORT.BMP" with "SEGUIR" or "ANULˇLAR"
			conditions
			when It is "SEGUIR"
			export resource bitmap vmot as "\signe2\export.bmp" 
			when It is "ANULˇLAR"
			sysCursor=1
			break
			end conditions
			end if
			sysCursor=1
	end	

	if mAlias="grupsig"
	
	sysCursor=4
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	request "Per importar un grup de grāfics llegiu prčviament l'ajuda.Voleu continuar la importaciķ?" with "SI" or "NO" or "Ajuda"

	conditions
	
			when It is "AJUDA"
	
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuimportar"
		show viewer "ajuda"
		
			when It is "NO"
			sysCursor=1
			break
			when It is "SI"
			

	linkDll "tbdlg.dll"
		STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
	end linkDll
	
	strCaption = "Importar un text"
	strFilterList = ""
	
	push "Tots els fitxers (*.*),*.*" onto strFilterList
	push "TXT(.Txt),*.txt" onto strFilterList
	get OpenFileDlg(strCaption,"","",strFilterList,1)
	

	if (it is not null)
	dades=It
	OpenFile dades
	readFile dades for 24242
	closeFile dades
	dades=it
	put It into fselect
	 step i from 1 to itemCount(fselect)
	--Place chaque élément de la sélection tour ā tour dans It
		pop fselect into vobra 
		search in RecordField "llista" for vobra as word
			
			if sysErrorNumber is not 641
			clear text of recordField "primerg1" of this page
			clear text of recordField "primer1" of this page
			insert graphic bitmap vobra after last word of text of recordField "primerg1" of page "gestio"
			put vobra after last word of text of recordField "primer1" of page "gestio"
			request "Vols canviar el grāfic" && vobra && "?" with "SI" or "NO"
		
			conditions

			when It is "No"
			
			continue
			
			when It is "SI"
			clear text of recordField "primerg1" of this page
			clear text of recordField "primer1" of this page
			send clear
			send clear
			mmclose all
			mmPlay clip signe2 in stage "videos" of this page
			mmPlay clip signe2p in stage "dibuix" of this page
			tres="7"&vobra
			export resource bitmap vobra as vmemoria&"."&"bmp"
			remove resource bitmap vobra of this book
			remove resource clip tres
			remove resource clip vobra
			import bitmap resource vobra&"."&"bmp" as vobra
			mdibu= "\signe2\dibuix\"&tres&"."&"gif"
			new clip from mdibu
			name of It = tres
			mpeli= "\signe2\videos\"&vobra&"."&"avi"
			new clip from mpeli
			name of It = vobra
			
			insert graphic bitmap vobra after last word of text of recordField "primerg1" of page "gestio"
			put vobra after last word of text of recordField "primer1" of page "gestio"
			
			if text of recordField "primerg1" of this page is null
			request "No ha trobat el dibuix" && vobra && "Vols triar-lo ara?" with "SI" or "NO"
	
				conditions
					when It is "NO"
					newLine = vobra
			send insertLine newLine to recordfield "llista" of this page
			clear text of recordField "primerg1" of this page
			clear text of recordField "primer1" of this page
			tres="7"&vobra
			import bitmap resource vmemoria&"."&"bmp" as vobra			
		
			mgrafic=vmemoria
			insert graphic bitmap vobra after last word of text of recordField "primerg1" of page "gestio"
			put vobra into text of recordField "primer1" of this page
			continue
				
					when It is "SI"
			
			linkDll "tbdlg.dll"
			STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
			end linkDll
			strCaption = "Trieu un fitxer grāfic"
			strFilterList = ""
	
			push "Tots els fitxers (*.*),*.*" onto strFilterList
			push "Device Independent Bitmap (*.DIB),*.DIB" onto strFilterList
			push "Bitmap(*.BMP),*.BMP" onto strFilterList

			get OpenFileDlg(strCaption,"","",strFilterList,1)
					if (it is null)
			newLine = vobra
			send insertLine newLine to recordfield "llista" of this page
			clear text of recordField "primerg1" of this page
			clear text of recordField "primer1" of this page

			tres="7"&vobra	
			import bitmap resource vmemoria&"."&"bmp" as vobra
	
			mgrafic=vmemoria
			insert graphic bitmap vobra after last word of text of recordField "primerg1" of page "gestio"
			put vobra into text of recordField "primer1" of this page
			continue
		
		else
		
			newLine = vobra
			send insertLine newLine to recordfield "llista" of this page

			tres="7"&vobra
			remove resource bitmap vobra of this book
	
			import bitmap resource It as vobra
	

			search in recordField "llista" for vobra as word
			clear text of recordField "primerg1" of this page
			clear text of recordField "primer1" of this page
			send clear
			send clear
			mmclose all
			mmPlay clip signe2 in stage "videos" of this page
			mmPlay clip signe2p in stage "dibuix" of this page
			tres="7"&vobra
			export resource bitmap vobra as vmemoria&"."&"bmp"
			remove resource bitmap vobra of this book
			remove resource clip tres
			remove resource clip vobra
			import bitmap resource vobra&"."&"bmp" as vobra
			mdibu= "\signe2\dibuix\"&tres&"."&"gif"
			new clip from mdibu
			name of It = tres
			mpeli= "\signe2\videos\"&vobra&"."&"avi"
			new clip from mpeli
			name of It = vobra
			mgrafic=word vobra of the text of field "item" of page "gestio"	
			insert graphic bitmap vobra after last word of text of recordField primerg1 of page "gestio"
			

		end if	
		
		end conditions	
		
		
		
		
end if
		newLine=vobra
		send insertLine newLine to recordfield "llista" of this page
		
		
		end conditions	
	
		else
		clear text of recordField "primerg1" of this page
		clear text of recordField "primer1" of this page

		tres="7"&vobra
		import bitmap resource vobra&"."&"bmp" as vobra

		mdibu= "\signe2\dibuix\"&tres&"."&"gif"
		new clip from mdibu
		name of It = tres
		mpeli= "\signe2\videos\"&vobra&"."&"avi"
		new clip from mpeli
		name of It = vobra
		insert graphic bitmap vobra after last word of text of recordField "primerg1" of page "gestio"
		put vobra after last word of text of recordField "primer1" of page "gestio"
		if text of recordField "primerg1" of this page is null
		
		request "No ha trobat el dibuix" && vobra && "Vols triar-lo ara?" with "SI" or "NO"
		conditions
			when It is "No"
			continue
			when It is "SI"
		
		
			linkDll "tbdlg.dll"
			STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
			end linkDll
			strCaption = "Trieu un fitxer grāfic"
			strFilterList = ""
	
			push "Tots els fitxers (*.*),*.*" onto strFilterList
			push "Device Independent Bitmap (*.DIB),*.DIB" onto strFilterList
			push "Bitmap(*.BMP),*.BMP" onto strFilterList

			get OpenFileDlg(strCaption,"","",strFilterList,1)
			if (it is null)

			continue
		


		else
		
		newLine = vobra
		send insertLine newLine to recordfield "llista" of this page
		tres="7"&vobra
		remove resource bitmap vobra of this book
		import bitmap resource It as vobra
		search in RecordField "llista" for vobra as word
		clear text of recordField "primerg1" of this page
		clear text of recordField "primer1" of this page
		send clear
		send clear
		mmclose all
		mmPlay clip signe2 in stage "videos" of this page
		mmPlay clip signe2p in stage "dibuix" of this page
		remove resource clip vobra
		remove resource clip tres
		mdibu= "\signe2\dibuix\"&tres&"."&"gif"
		new clip from mdibu
		name of It = tres
		mpeli= "\signe2\videos\"&vobra&"."&"avi"
		new clip from mpeli
		name of It = vobra
		
		mgrafic=word vobra of the text of field "item" of page "gestio"	
		insert graphic bitmap vobra after last word of text of recordField "primerg1" of page "gestio"
		end if	
		
		end conditions	
		
		end if

		newLine=vobra
		send insertLine newLine to recordfield "llista" of this page
		go to page "categories" of this book
		newLine = vobra
		send insertLine newLine to recordfield "llista" of page "categories"
		search in RecordField "llista" of page "categories" for vobra as word
		put text of recordfield "llista" of page "categories" into vbenji
		put vbenji into text of field "index" of page "categories"
		go to page gestio of this book
				
		end if
	
	end step

end
end conditions
	put text of recordfield "llista" into vbenji
	put vbenji into text of field "index" of this page
	clear text of recordfield "primer1" of this page
	clear text of recordfield "primerg1" of this page
	clear text of field "item" of this page
	go to page "frase" of this book
	go to page "gestio" of this book
	focus=field "item"
	sysCursor=1
end	
	
	
	forward to system
end	menuItemSelected

to handle exit
	request "           Segur que voleu sortir?" with "SI" or "NO"
	if it is "SI" then
	
	sysSuspendMessages = true

	forward
	end if
end exit

to handle lectura

	system vtipus
	system mgrafic
	close viewer "histories"
	close viewer "videos"
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	if text of recordField "texte" of page frase is not null
	if vtipus=anima
	request "Quin tipus de lectura vols?" with "PICTOGRAMES" or "FILMACIONS"
	
			conditions
			when It is "PICTOGRAMES"
			
	sysCursor=4

	clear text of recordField "primerg1" of this page
	clear text of recordField "primer11" of this page
	un1=text of recordfield "texte" of this page
	step ctr from 1 to wordCount(un1)
	un= word ctr of un1
	show group visual1 of this background
	if keyState(keyEscape) is "Up"
	select word ctr of text of recordfield "texte" of this page
	send bold
	strokeColor of word ctr of text of recordfield "texte" of this page = blue
	fontStyle of text of recordfield "texte" of this page = null
	insert graphic bitmap un into text of RecordField "primerg1" of this page

	if text of RecordField "primerg1" of this page is not null
	send continue
	else
		put first char of un into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if

		
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if un is in meu
	put meu into text of recordField "solucio" of this page
	search in RecordField "solucio" for un as word
	if sysErrorNumber = 641
	continue
	else 
	put word 1 of meu into meu1
	end if
	end if
	end step
	insert graphic bitmap meu1 into text of RecordField primerg1 of this page
	clear meu1
	end if
	put un into text of RecordField primer11 of this page
	select word ctr of text of recordfield "texte" of this page
	send normal
	pause 150
	clear text of recordField "primer11" of this page
	clear text of recordField "primerg1" of this page
	else
	fontStyle of text of recordfield "texte" of this page = null
	strokeColor of text of recordfield "texte" of this page = black
	hide group visual1 of this background
	sysCursor=1
	break
	end if
	end step
	fontStyle of text of recordfield "texte" of this page = null
	strokeColor of text of recordfield "texte" of this page = black
	hide group visual1 of this background
	
	when It is "FILMACIONS"
	
	sysCursor=4

	show group visual of this background
	show recordField "primer1" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer11" of this page
	clear text of recordField "primer1" of this page
	un1=text of recordfield "texte" of this page
	step ctr from 1 to wordCount(un1)
	un= word ctr of un1

		put first char of un into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if

	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if un is in meu
	put meu into text of recordField "solucio" of this page
	search in RecordField "solucio" for un as word
	if sysErrorNumber = 641
	continue
	else 
	put word 1 of meu into meu1
	end if
	end if
	end step

	if keyState(keyEscape) is "Up"
	select word ctr of text of recordfield "texte" of this page
	send bold
	strokeColor of word ctr of text of recordfield "texte" of this page = blue
	clear text of recordField "primer1" of this page
	put un into text of RecordField primer1 of this page
	mmOpen clip un
	if sysErrorNumber is not 8293
	mmPlay clip un in stage "lectura" of this background wait
	mmClose clip un
	clear un
	clear meu1
	else
	put meu1 into un
	mmOpen clip un
	mmPlay clip un in stage "lectura" of this background wait
	mmClose clip un
	mmclose meu1
	clear meu1
	clear un
	end
	select word ctr of text of recordfield "texte" of this page
	send normal
	pause 40
	else
	fontStyle of text of recordfield "texte" of this page = null
	strokeColor of text of recordfield "texte" of this page = black
	mmClose clip un
	hide group visual of this background
	break
	sysCursor=1
	end if
	end step
	fontStyle of text of recordfield "texte" of this page = null
	strokeColor of text of recordfield "texte" of this page = black
	hide group visual of this background
	end conditions

	else
	sysCursor=4

	sysCursor=4

	clear text of recordField "primerg1" of this page
	clear text of recordField "primer11" of this page
	un1=text of recordfield "texte" of this page
	step ctr from 1 to wordCount(un1)
	un= word ctr of un1
	show group visual1 of this background
	if keyState(keyEscape) is "Up"
	select word ctr of text of recordfield "texte" of this page
	send bold
	strokeColor of word ctr of text of recordfield "texte" of this page = blue
	fontStyle of text of recordfield "texte" of this page = null
	insert graphic bitmap un into text of RecordField "primerg1" of this page

	if text of RecordField "primerg1" of this page is not null
	send continue
	else
		put first char of un into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if		
		
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if un is in meu
	put meu into text of recordField "solucio" of this page
	search in RecordField "solucio" for un as word
	if sysErrorNumber = 641
	continue
	else 
	put word 1 of meu into meu1
	end if
	end if
	end step
	insert graphic bitmap meu1 into text of RecordField "primerg1" of this page
	clear meu1
	end if
	put un into text of RecordField "primer11" of this page
	select word ctr of text of recordfield "texte" of this page
	send normal
	pause 150
	clear text of recordField "primer11" of this page
	clear text of recordField "primerg1" of this page
	else
	fontStyle of text of recordfield "texte" of this page = null
	strokeColor of text of recordfield "texte" of this page = black
	hide group visual1 of this background
	sysCursor=1
	break
	end if
	end step
	fontStyle of text of recordfield "texte" of this page = null
	strokeColor of text of recordfield "texte" of this page = black
	hide group visual1 of this background
	end if				

	else
	request "No hi ha cap text"
	end if

	mmClose clip un
	mmClose clip meu1
	sysCursor=1
	focus=recordfield "titol" of this page
end

	to handle formatlletra
	linkDLL "TBDLG.DLL"
		STRING chooseFontDlg(STRING,STRING)
	end linkDLL
	get chooseFontDlg("Arial,10,0,0,0,regular,normal", \
		"trueTypeOnly")
	if It is null
		break
	else
		fontFace of self = item 1 of It
		fontSize of self = item 2 of It	
		fontStyle of self= item 3 of It
		
				
		sysfontFace=item 1 of It
		sysfontSize=item 2 of It
		sysfontStyle=item 3 of It
		
		fontFace of text of recordfield "texte" of page "frase"= item 1 of It
		fontSize of text of recordfield "texte" of page "frase" = "11"
		
		fontFace of text of recordfield "titol" of page "frase"= item 1 of It
		fontSize of text of recordfield "titol" of page "frase" = "12"

		fontFace of text of recordfield "para1" = item 1 of It
		fontSize of text of recordfield "para1" = item 2 of It
		fontStyle of text of recordfield "para1" = item 3 of It
		
		fontFace of text of recordfield "para2" = item 1 of It
		fontSize of text of recordfield "para2" = item 2 of It
		fontStyle of text of recordfield "para2" = item 3 of It
		
		fontFace of text of recordfield "para3" = item 1 of It
		fontSize of text of recordfield "para3" = item 2 of It
		fontStyle of text of recordfield "para3" = item 3 of It
		
		fontFace of text of recordfield "para4" = item 1 of It
		fontSize of text of recordfield "para4" = item 2 of It
		fontStyle of text of recordfield "para4" = item 3 of It
		
		fontFace of text of recordfield "para5" = item 1 of It
		fontSize of text of recordfield "para5" = item 2 of It
		fontStyle of text of recordfield "para5" = item 3 of It
		
		fontFace of text of recordfield "para6" = item 1 of It
		fontSize of text of recordfield "para6" = item 2 of It
		fontStyle of text of recordfield "para6" = item 3 of It
		
		fontFace of text of recordfield "para7" = item 1 of It
		fontSize of text of recordfield "para7" = item 2 of It
		fontStyle of text of recordfield "para7" = item 3 of It
		
		fontFace of text of recordfield "para8" = item 1 of It
		fontSize of text of recordfield "para8" = item 2 of It
		fontStyle of text of recordfield "para8" = item 3 of It	
	
		fontFace of text of recordfield "para9" = item 1 of It
		fontSize of text of recordfield "para9" = item 2 of It
		fontStyle of text of recordfield "para9" = item 3 of It
		
		fontFace of text of recordfield "para10" = item 1 of It
		fontSize of text of recordfield "para10" = item 2 of It
		fontStyle of text of recordfield "para10" = item 3 of It
		
		fontFace of text of recordfield "para11" = item 1 of It
		fontSize of text of recordfield "para11" = item 2 of It
		fontStyle of text of recordfield "para11" = item 3 of It
		
		fontFace of text of recordfield "para12" = item 1 of It
		fontSize of text of recordfield "para12" = item 2 of It
		fontStyle of text of recordfield "para12" = item 3 of It
		
		fontFace of text of recordfield "para13" = item 1 of It
		fontSize of text of recordfield "para13" = item 2 of It
		fontStyle of text of recordfield "para13" = item 3 of It
		
		fontFace of text of recordfield "para14" = item 1 of It
		fontSize of text of recordfield "para14" = item 2 of It
		fontStyle of text of recordfield "para14" = item 3 of It
		
		fontFace of text of recordfield "para15" = item 1 of It
		fontSize of text of recordfield "para15" = item 2 of It
		fontStyle of text of recordfield "para15" = item 3 of It
		
		fontFace of text of recordfield "para16" = item 1 of It
		fontSize of text of recordfield "para16" = item 2 of It
		fontStyle of text of recordfield "para16" = item 3 of It	
		
		fontFace of text of recordfield "para17" = item 1 of It
		fontSize of text of recordfield "para17" = item 2 of It
		fontStyle of text of recordfield "para17" = item 3 of It
		
		fontFace of text of recordfield "para18" = item 1 of It
		fontSize of text of recordfield "para18" = item 2 of It
		fontStyle of text of recordfield "para18" = item 3 of It
		
		fontFace of text of recordfield "para19" = item 1 of It
		fontSize of text of recordfield "para19" = item 2 of It
		fontStyle of text of recordfield "para19" = item 3 of It
		
		fontFace of text of recordfield "para20" = item 1 of It
		fontSize of text of recordfield "para20" = item 2 of It
		fontStyle of text of recordfield "para20" = item 3 of It
		
		fontFace of text of recordfield "para21" = item 1 of It
		fontSize of text of recordfield "para21" = item 2 of It
		fontStyle of text of recordfield "para21" = item 3 of It
		
		fontFace of text of recordfield "para22" = item 1 of It
		fontSize of text of recordfield "para22" = item 2 of It
		fontStyle of text of recordfield "para22" = item 3 of It
		
		fontFace of text of recordfield "para23" = item 1 of It
		fontSize of text of recordfield "para23" = item 2 of It
		fontStyle of text of recordfield "para23" = item 3 of It
		
		fontFace of text of recordfield "para24" = item 1 of It
		fontSize of text of recordfield "para24" = item 2 of It
		fontStyle of text of recordfield "para24" = item 3 of It	
	
		fontFace of text of recordfield "para25" = item 1 of It
		fontSize of text of recordfield "para25" = item 2 of It
		fontStyle of text of recordfield "para25" = item 3 of It
		
		fontFace of text of recordfield "para26" = item 1 of It
		fontSize of text of recordfield "para26" = item 2 of It
		fontStyle of text of recordfield "para26" = item 3 of It
		
		fontFace of text of recordfield "para27" = item 1 of It
		fontSize of text of recordfield "para27" = item 2 of It
		fontStyle of text of recordfield "para27" = item 3 of It
		
		fontFace of text of recordfield "para28" = item 1 of It
		fontSize of text of recordfield "para28" = item 2 of It
		fontStyle of text of recordfield "para28" = item 3 of It
		
		fontFace of text of recordfield "para29" = item 1 of It
		fontSize of text of recordfield "para29" = item 2 of It
		fontStyle of text of recordfield "para29" = item 3 of It
		
		fontFace of text of recordfield "para30" = item 1 of It
		fontSize of text of recordfield "para30" = item 2 of It
		fontStyle of text of recordfield "para30" = item 3 of It
		
		fontFace of text of recordfield "para31" = item 1 of It
		fontSize of text of recordfield "para31" = item 2 of It
		fontStyle of text of recordfield "para31" = item 3 of It
		
		fontFace of text of recordfield "para32" = item 1 of It
		fontSize of text of recordfield "para32" = item 2 of It
		fontStyle of text of recordfield "para32" = item 3 of It	
		
		fontFace of text of recordfield "para33" = item 1 of It
		fontSize of text of recordfield "para33" = item 2 of It
		fontStyle of text of recordfield "para33" = item 3 of It
		
		fontFace of text of recordfield "para34" = item 1 of It
		fontSize of text of recordfield "para34" = item 2 of It
		fontStyle of text of recordfield "para34" = item 3 of It
		
		fontFace of text of recordfield "para35" = item 1 of It
		fontSize of text of recordfield "para35" = item 2 of It
		fontStyle of text of recordfield "para35" = item 3 of It
		
		fontFace of text of recordfield "para36" = item 1 of It
		fontSize of text of recordfield "para36" = item 2 of It
		fontStyle of text of recordfield "para36" = item 3 of It
		
		fontFace of text of recordfield "para37" = item 1 of It
		fontSize of text of recordfield "para37" = item 2 of It
		fontStyle of text of recordfield "para37" = item 3 of It
		
		fontFace of text of recordfield "para38" = item 1 of It
		fontSize of text of recordfield "para38" = item 2 of It
		fontStyle of text of recordfield "para38" = item 3 of It
		
		fontFace of text of recordfield "para39" = item 1 of It
		fontSize of text of recordfield "para39" = item 2 of It
		fontStyle of text of recordfield "para39" = item 3 of It
		
		fontFace of text of recordfield "para40" = item 1 of It
		fontSize of text of recordfield "para40" = item 2 of It
		fontStyle of text of recordfield "para40" = item 3 of It
		
		fontFace of text of recordfield "para41" = item 1 of It
		fontSize of text of recordfield "para41" = item 2 of It
		fontStyle of text of recordfield "para41" = item 3 of It	
	
		fontFace of text of recordfield "para42" = item 1 of It
		fontSize of text of recordfield "para42" = item 2 of It
		fontStyle of text of recordfield "para42" = item 3 of It
		
	fontface of text of field "titol1" of page "mostra1"=sysfontFace
	put sysfontsize into suma
	suma1=suma+2
	fontSize of text of field "titol1" of page "mostra1"=suma1
	fontStyle of text of field "titol1" of page "mostra1"=underline

	end if
end
----------------------------------------------------------------------
sharedscript id 100 ("pagines")
----------------------------------------------------------------------
to handle enterPage
	system mtexte
	system mgrafic
	system mespai
	system mparaula
	system mmester
	nombrep=1
	step nombre from 1 to 42
	paraulap="para"&nombrep
	quadrep="parag"&nombrep
	clear text of recordField paraulap of this page
	clear text of recordField quadrep of this page
	nombrep=nombrep+1
	end step

	sysPageScroll= 0,0
	
	clear mgrafic
	clear meu1
	
	if this page is page "mostra1" of this book
	mtitol=text of recordField titol of page "frase"
	clear text of field "titol1" of page "mostra1"
	put mtitol into text of field "titol1" of page "mostra1"
	mparaula=1
	end if
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	mmester=mmester+42
	mmbenji=mmester
	nombre=1
	
	un1=text of recordfield "texte" of page "frase"
	step ctr from mparaula to mmbenji
	mgrafic= word ctr of un1
	if mgrafic is not null
	paraula=para&nombre
	put mgrafic into text of RecordField paraula of this page
	quadre=parag&nombre
	insert graphic bitmap mgrafic into text of RecordField quadre of this page
	nombre=nombre+1

	if text of RecordField quadre of this page is not null
	send continue
	else
		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	insert graphic bitmap meu1 into text of RecordField quadre of this page
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page
	end if
	clear mgrafic
	else 
	break
	end if
	end step
	sysCursor=1
end
----------------------------------------------------------------------
Page id 16 ("inicial") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	system vtipus
	vtipus=anima
	menuBar of viewer ID 0 = menuBar "llarga"
	disable menu "Llegir" at reader	
	disable menu "Ediciķ" at reader
	disable menu "Lletra" at reader
	disable menu "Pāgina" at reader
	disable menu "Categories" at reader
	disable menuItem "Imprimir el text" at reader
	disable menuItem "Imprimir la pāgina" at reader
	disable menuItem "Importar text" at reader
--	disable menuItem "Editor de text bilingüe" at reader
	disable menuItem "Importar dibuixos d'objectes" at reader
	disable menuItem "Importar filmacions de signes" at reader
	disable menuItem "Exportar pictograma del signe" at reader
	disable menuItem "Importar grups de signes" at reader
	
	hide group "entrada" of this page
	show button "gestio" of this page
	show button "frase" of this page	
	forward
--  a la pagina	gestio s'oculten botons GIF i AVI
--  per carregar grups de filmacions i objectes
--  tot i que cal carregar de pocs en pocs
end	

to handle leavePage
	restore menuBar
	forward
end
----------------------------------------------------------------------
Button id 33 ("Mostrar") of Page id 16 (p. 1)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	close viewer "histories"
	close viewer "videos"
	if text of recordField "texte" of page "frase" is null 
	go to page "mostra1"
	else
		if text of recordField "texte" is not null
	
	search in recordField "texte" for ","by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "("by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ")"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ";"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "-"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
		search in recordField "texte" for ":"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "!"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "CRLF"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	
		go to page "mostra1"
		syscursor = 1
	end if
	end if
end	
----------------------------------------------------------------------
Button id 31 ("Acabar") of Page id 16 (p. 1)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	send exit
end	

----------------------------------------------------------------------
Button id 21 ("frase") of Page id 16 (p. 1)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	clear text of recordField "titol" of page "frase"
	clear text of recordField "texte" of page "frase"
	go to page "frase"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 20 ("ajuda") of Page id 16 (p. 1)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end
----------------------------------------------------------------------
Button id 17 ("gestio") of Page id 16 (p. 1)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	syscursor = 4
	go to page "gestio"
	syscursor = 1
end	
----------------------------------------------------------------------
RecordField id 0 ("llista") of Background id 11
----------------------------------------------------------------------
notifyBefore enterPage
	system ARRAY STRING itemArray[]
	
	fill itemArray with my text in [textline] order
	set my selectedTextlines to 1
	set my scroll to 0
end enterPage

to handle buttonUp
	set text of recordfield "text" to selectedText
end buttonUp


to handle sortSelf
	local ARRAY dataArray[]
	local STRING sortedText
	sysCursor = 4
	-- put the textlines into an array
	fill dataArray with my text in [textline] order
	-- sort the array
	send quickSort dataArray
	-- convert the array back into textlines
	step i from 1 to dimensions(dataArray)
		put dataArray[i] & CRLF after sortedText
	end step
	-- get rid of trailing crlf's
	clear last char of sortedText
	clear last char of sortedText
	-- update the text
	set my text to sortedText
	sysCursor = default
end sortSelf

-- The next three handlers make up a Standard recursive QuickSort.
-- Keep in mind that arrays are passed by reference, not by value.
to handle quickSort fArray[] by reference
	system s_noSwap
	set s_noSwap to 0
    send quickSrt fArray, 1, dimensions ( fArray )
end quickSort

to handle quickSrt fArray[] by reference, lo, hi
    system  s_noSwap
    if hi > lo 
		send swap  fArray, lo, ((lo+hi) div 2)
		set lst to lo
		step i from (lo+1) to hi
        	if fArray[i] < fArray[lo] as text
        		increment lst
        		send swap fArray, lst, i
        	else
        		increment s_noswap
        	end if
        end step
        send swap fArray,lo,lst 
   		send quicksrt fArray, lo, lst-1
    	send quicksrt fArray, lst+1,hi
   	end if
end quickSrt

to handle swap fArray[] by reference, x, y
	local temp
	set temp to fArray[x]
	set fArray[x] to fArray[y]
	set fArray[y] to temp
end swap


-- use if inserting a single line. Will maintain sorted order
to handle insertLine newLine
	set my text to insertLineAux(my text,newLine)
end insertLine

-- inserts newLine into txt, maintaining sorted order.
-- works only if txt is already sorted.
to get insertLineAux txt,newLine
	if txt is null
		return newLine
	end if
	set start to 1  -- first textline
	set tlc to textlinecount(txt)
	set ending to tlc -- last textline
	local insertSpot
	while start <= ending 
		set midPoint to (start+ending) div 2 
		set middleLine to textline midPoint of txt
		conditions
		when newLine < middleLine as text
			-- start looking at values less than current midPoint
			set ending to midPoint-1
			set insertSpot to midPoint
		when newLine > middleLine as text
			-- start looking at values greater than current midPoint
			set start to midPoint+1
			set insertSpot to midPoint+1
		else
			-- the item already exists
			set insertSpot to midPoint
			break while
		end conditions
	end while
	if insertSpot > tlc
		put newLine before textline insertSpot of txt
	else
		put newLine&crlf before textline insertSpot of txt
	end if
	return txt
end insertLineAux


----------------------------------------------------------------------
Page id 17 ("Gestio") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	system vtipus
	system vnumvideo
	system vnumdibu
	system mcarrega
	hide button "AVI" of this page
	hide button "GIF" of this page
	restore menuBar
	disable menu "Llegir" at reader
	disable menu "Pāgina" at reader
	disable menu "Ediciķ" at reader
	disable menu "Lletra" at reader
	disable menu "Categories" at reader
	disable menuItem "Editor de grāfics" at reader
--	disable menuItem "Editor de text bilingüe" at reader
	disable menuItem "Importar text" at reader
	disable menuItem "Imprimir el text" at reader
	disable menuItem "Imprimir la pāgina" at reader	

	if vtipus=anima
	mmOpen vnumvideo

	text of comboBox "llistat" of background "frase"= "                TRIA UN CONTE O UNA HISTŌRIA:"	
	enabled of button "pelicula" of page "frase" = false
	show stage "videos" of this page
	show group mmCOntrols of this page	
	
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	mmClose all
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	focus=field "item" of this page
	
	
	else
	hide stage "videos" of this page
	hide group mmCOntrols of this page
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page



	end if
end	

to handle leavePage
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	

	restore menuBar
	disable menu "Llegir" at reader	
	disable menu "Categories" at reader
	close viewer "videos"
	close viewer "histories"
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	mmClose all
	forward
end




----------------------------------------------------------------------
Button id 122 ("Mostrar") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	close viewer "histories"
	close viewer "videos"
	if text of recordField "texte" of page "frase" is null 
	go to page "mostra1"
	else
		if text of recordField "texte" is not null
	
	search in recordField "texte" for ","by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "("by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ")"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ";"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "-"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
		search in recordField "texte" for ":"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "!"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "CRLF"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	
		go to page "mostra1"
		syscursor = 1
	end if
	end if
end	
----------------------------------------------------------------------
Button id 119 ("eliminar") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	sysCursor=4
	system vnumsigne
	system mgrafic
	if text of field "item" of this page is null
	request "Heu de posar el nom del dibuix abans"
	sysCursor=1
	break

	else	
	
	put text of field "item" of this page into un
	put text of field "index" into vbenji
	put vbenji into text of recordfield "llista" of this page	
	
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	put text of field "item" of this page into un
	search in RecordField "llista" for un as word
	if sysErrorNumber=641
	request "No existeix el grāfic" && un
	sysCursor=1

	else
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	mgrafic=word un of the text of field "item" of this page
	dos="7"&un
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page

	put un after last word of text of recordField "primer1" of this page
	put text of recordField "primer1" of this page into vnumsigne
	request "Segur que voleu suprimir" && un &"?" 	with "SI" or "NO"
	conditions
	when It is "SI"
	send clear
	send clear
	mmclose all
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "videos" of this page
	remove resource clip un
	remove resource clip dos
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "videos" of this page

	remove resource bitmap un of this book

		
	
	search in RecordField "llista" for un as word
	send clear
	send clear

	go to page "categories1" of this book
	search page records for un as word
	while "not found" is not in sysError
	send clear
	search again
	end while

	go to page "categories" of this book
	search in RecordField "llista" for un as word
	send clear
	send clear
	put text of recordfield "llista" of page "categories" into vbenji
	put vbenji into text of field "index" of page "categories"	
	
	go to page "verb" of this book
	search in RecordField "llista" for un as word
	send clear
	send clear
	put text of recordfield "llista" of page "categories" into vbenji
	put vbenji into text of field "index" of page "categories"	
	go to page "gestio" of this book
	
	when It is "NO"
	sysCursor=1
	break
	end conditions
	end if
	end if
	put text of recordField "llista" into vbenji
	put vbenji into text of field "index" of this page
	go to page "frase" of this book
	go to page "gestio" of this book
	sysCursor=1
end
----------------------------------------------------------------------
Button id 117 ("cercar") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end

to handle buttonClick
	system vtipus
	system vnumsigne
	system vnumdibu	
	system mgrafic

	if vtipus=anima
	sysCursor=4

	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	un=text of field "item" of this page
	dos="7"&un
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page
	put un after last word of text of RecordField "primer1" of this page
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	mmClose clip vnumdibu
	mmClose clip vnumsigne
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	if text of RecordField "primerg1" of this page is not null
	sysCursor=1
	break
	else
	request "No hi ha el grāfic del signe" && un
	end if
	sysCursor=1
	
	else

	sysCursor=4
	un=text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of page "Gestio"
	put un after last word of text of RecordField primer1 of page "Gestio"
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	if text of RecordField "primerg1" of this page is not null
	sysCursor=1
	break
	else
	sysCursor=1
	request "No hi ha el grāfic del signe" && un
	end if
	sysCursor=1
	
	end if
end
----------------------------------------------------------------------
Button id 116 ("GIF") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle buttonClick
	system mdibu
	linkDll "tbdlg.dll"
		STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
	end linkDll
	
	strCaption = "Importar un text"
	strFilterList = ""
	
	push "Tots els fitxers (*.*),*.*" onto strFilterList
	push "TXT(.Txt),*.txt" onto strFilterList
	get OpenFileDlg(strCaption,"","",strFilterList,1)
	

	if (it is not null)
	dades=It
	OpenFile dades
	readFile dades for 24242
	closeFile dades
	dades=it
	put It into fselect
	 step i from 1 to itemCount(fselect)
	--Place chaque élément de la sélection tour ā tour dans It
		pop fselect into vobra 
			mdibu= "\signe2\dibuix\"&vobra&"."&"gif"
			new clip from mdibu
			name of It = vobra
					
	end step

	end if		

end

----------------------------------------------------------------------
Button id 115 ("AVI") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle buttonClick
	system mpeli
	linkDll "tbdlg.dll"
		STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
	end linkDll
	
	strCaption = "Importar un text"
	strFilterList = ""
	
	push "Tots els fitxers (*.*),*.*" onto strFilterList
	push "TXT(.Txt),*.txt" onto strFilterList
	get OpenFileDlg(strCaption,"","",strFilterList,1)
	

	if (it is not null)
	dades=It
	OpenFile dades
	readFile dades for 24242
	closeFile dades
	dades=it
	put It into fselect
	 step i from 1 to itemCount(fselect)
	--Place chaque élément de la sélection tour ā tour dans It
		pop fselect into vobra 
			mpeli= "\signe2\videos\"&vobra&"."&"avi"
			new clip from mpeli
			name of It = vobra
					
	end step

	end if		

end

----------------------------------------------------------------------
Button id 107 ("GRAFICS") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	sysCursor=4
	system sLastResPlayed
	system mgrafic
	system vnumsigne
	system vnumdibu	
	if text of field "item" of this page is null
		request "Heu de posar el nom del dibuix abans"
		break
		else	
		
		put text of field "item" of this page into un
		put text of field "index" into vbenji
		put vbenji into text of recordfield "llista" of this page
		
			search in RecordField "llista" for un as word
		if sysErrorNumber is not 641
	mmPlay clip signe2 in stage "videos" of this page
	un=text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	tres="7"&un
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page
	put un after last word of text of RecordField "primer1" of this page
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
			request "Per canviar el dibuix abans l'heu de suprimir"
			break
	else
	linkDll "tbdlg.dll"
		STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
	end linkDll
	strCaption = "Trieu un fitxer grāfic"
	strFilterList = ""
	push "Tots els fitxers (*.*),*.*" onto strFilterList
	push "Device Independent Bitmap (*.DIB),*.DIB" onto strFilterList
	push "Bitmap(*.BMP),*.BMP" onto strFilterList
	get OpenFileDlg(strCaption,"","",strFilterList,1)
	put text of field "item" of this page into un
	if (it is not null)
	sysCursor=4
	newLine = un
	send insertLine newLine to recordfield "llista" of this page
	import bitmap resource It as un

	tres="7"&un
	mdibu= "\signe2\dibuix\"&tres &"."&"gif"
	new clip from mdibu
	name of It = tres
	
	mpeli= "\signe2\videos\"&un &"."&"avi"
	new clip from mpeli
	name of It = un
	end if
	search in RecordField "llista" for un as word
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page

	mgrafic=word un of the text of field "item" of this page
	insert graphic bitmap un after last word of text of recordField "primerg1" of this page
	if text of recordField "primerg1" is not null
	put un after last word of text of recordField primer1 of this page
	put text of recordfield "primer1" of this page into vnumsigne


	else
	sysCursor=4
	clear text of field "item" of this page 
	mmClose all
	break
	end if
end if
end if
	put text of recordfield "llista" into vbenji
	put vbenji into text of field "index" of this page
	go to page "categories" of this book
	newLine = un
	send insertLine newLine to recordfield "llista" of page "categories"
	search in recordField "llista" of page "categories" for un as word
	put text of recordfield "llista" of page "categories" into vbenji
	put vbenji into text of field "index" of page "categories"
	go to page "gestio" of this book
	tres="7"&un
	put un into text of field "item" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page
	put un after last word of text of RecordField "primer1" of this page
	put text of recordfield "primer1" of this page into vnumsigne
	put tres into vnumdibu
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	sysCursor=1
end


----------------------------------------------------------------------
Button id 104 ("Diccionari") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		syscursor = 4	
		put text of field "index" of this page into vnoms
		clear text of recordfield "texte" of page "frase"
		put "DICCIONARI" into text of recordfield titol of page "frase"
		put vnoms into text of recordfield "texte" of page "frase"
		go to next page
		go to page mostra1
		syscursor = 1
end	
----------------------------------------------------------------------
Button id 101 ("Acabar") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		request "Voleu salvar els canvis per a properes sessions?" with "SI" or "NO" or "ANULˇLAR"
			conditions
			when It is "SI"
			syscursor = 4
			clear text of recordField "titol" of page "FRASE"
			clear text of recordField "texte" of page "FRASE"
			save changes to this book
			send exit
			when It is "NO"
			send exit
			when It is "ANULˇLAR"
			break
			end conditions
end	


	
----------------------------------------------------------------------
Button id 88 ("Acabar") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
			sysCursor=4
			if text of recordfield "primerg1" is null
			request "No heu seleccionat cap pictograma"
			sysCursor=1
			break
			else
			vmot=text of field "item" of this page
			request "S'exportarā el pictograma" && vmot && "al directori \SIGNE2 amb el nom EXPORT.BMP" with "SEGUIR" or "ANULˇLAR"
			conditions
			when It is "SEGUIR"
			export resource bitmap vmot as "\signe2\export.bmp" 
			when It is "ANULˇLAR"
			sysCursor=1
			break
			end conditions
			end if
			sysCursor=1
end	


	
----------------------------------------------------------------------
Field id 85 ("item") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle keyChar
	system ARRAY STRING itemArray[]
	
	local WORD itemNumber, stringLength
	local STRING string
	
	--vérifie que la matrice est initialisée
	if itemArray[1] = null
		--sinon, initialisez-la
		sendnotifyBefore enterPage to field "index"
	end if
	
	--fait suivre le caractčre tapé pour que le nouveau caractčre soit placé dans le champ
	forward
	
	--verrouille l'écran pendant la recherche de la corresondance la plus proche
	sysLockScreen = TRUE
	
	--met le texte en antémémoire pour ne pas avoir ā rechercher la propriété si souvent.
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of recordField "primer77" of this page
		mmclose all
	string = my text
	
	--stocke la longueur de la chaîne courante
	stringLength = charCount(my text)
	
	--stocke le nombre d'éléments du champ dans lequel la recherche s'effectue
	numberItems = dimensions(itemArray)
	
	--s'il y a du texte dans le champ, effectue une recherche pour trouver la correspondance 
	--la plus proche
	if stringLength > 0
		-- s'il y a un seul caractčre dans le champ, effectue une recherche binaire pour aller
		-- au début du groupe alphabétique de cette lettre
		if stringLength = 1

			get binarySearch(string)

			--sélectionne la ligne de texte trouvée et fait défiler le champ pour l'atteindre
			set selectedTextlines of field "index" to it
			set scroll of field "index" to it - 1

		--il y a plusieurs caractčres dans ce champ, donc commence la recherche séquentielle
		-- pour trouver la correspondance la plus proche
		else

			--commence ā la ligne actuellement sélectionnée qui est l'ancienne 					--correspondance la plus proche
			itemNumber = selectedTextlines of field "index"

			conditions
				
			--lorsque les premiers n caractčres de l'élément de la matrice sont inférieurs ā la 			--chaîne courante, il faut effectuer une recherche séquentielle vers le bas dans
			-- la matrice jusqu'ā ce que l'élément suivant soit supérieur ou égal ā la chaîne
			-- courante ou jusqu'ā atteindre la fin de la matrice
			when chars 1 to stringLength of itemArray[itemNumber] < string as text
				while chars 1 to stringLength of itemArray[itemNumber + 1] < string as text and \
				      itemNumber <= numberItems
					increment itemNumber
				end
				
				-- si l'on arręte la recherche parce que les chaînes sont égales, le
				-- nombre d'éléments devrait ętre incrémenté pour que la ligne égale,
				-- et non pas celle au-dessus, soit mise en surbrillance.
				if chars 1 to stringLength of itemArray[itemNumber + 1] = string as text
					increment itemNumber
				end
				
			-- lorsque les premiers n caractčres de l'élément de la matrice sont supérieurs 				-- ou égaux ā la chaîne courante, il faut effectuer une recherche séquentielle
			-- vers le haut dans la matrice jusqu'ā ce que l'élément suivant soit le premier
			-- dans la matrice ou soit l'élément < de matrice.
			when chars 1 to stringLength of itemArray[itemNumber] >= string as text
				while itemNumber > 1 and \
				  chars 1 to stringLength of itemArray[itemNumber - 1] >= string as text    
					decrement itemNumber
				end				
			end conditions
			
			--sélectionne la ligne de texte avec la correspondance la plus proche
			-- et la fait défiler
			set selectedTextlines of field "index" to itemNumber
			set scroll of field "index" to itemNumber - 1
		end if
	else
		--s'il n'y a pas de texte dans le champ, sélectionne la premičre ligne de texte
		--et la fait défiler vers le haut du champ
		set selectedTextlines of field "index" to 1
		set scroll of field "index" to 0
	end if
	sysLockScreen = FALSE
end keyChar

to get binarySearch string
	system ARRAY STRING itemArray[]
	
	--initialise les limites supérieures et inférieures et le point de départ de la recherche
	upper = dimensions (itemArray)
	lower = 1
	currentPosition = (lower + upper)  DIV 2
	
	found = FALSE
	
	-- diminue l'ampleur de la recherche jusqu'ā la découverte d'une correspondance ou jusqu'ā ce
	-- qu'il n'y a plus d'éléments ā rechercher
	while not found and (upper >= lower)
		conditions
		-- lorsque la chaîne est inférieure ā l'élément de la matrice, les éléments situés 				-- au-dessus de l'élément de la matrice sont éliminés et la recherche s'effectue				-- sur la moitié inférieure
		when string < char 1 of itemArray[currentPosition] as text
			upper = currentPosition - 1
			currentPosition = (lower + upper) DIV 2
			
		-- lorsque la chaîne est supérieure ā l'élément de la matrice, les éléments situés 
		--au-dessous de l'élément de la matrice sont éliminés et la recherche s'effectue
		-- sur la moitié supérieure
		when string > char 1 of itemArray[currentPosition] as text
			lower = currentPosition + 1
			currentPosition = (lower + upper) DIV 2
		else
		--soit nous avons une correspondance, soit la chaîne ne se trouve pas dans la matrice
			found = TRUE
		end conditions
	end while

	--si la recherche est arrętée parce que la correspondance exacte n'est pas trouvée, il faut
	--vérifier s'il est nécessaire d'aller d'un élément plus loin car l'élément aprčs lequel
	--la chaîne devrait aller est sélectionné dans la chaîne sans correspondance.
	if not found and string > char 1 of itemArray[currentPosition] as text
		increment currentPosition
	end if

	--nous devons nous assurer de sélectionner le premier élément qui correspond ā la chaîne,
	--ainsi, lorsqu'une correspondance est trouvée, il faut se déplacer vers le haut de la matrice
	--pour trouver l'élément.
	while currentPosition > 1 and string = char 1 of itemArray[currentPosition - 1] as text
		decrement currentPosition
	end while
	return currentPosition
end binarySearch
----------------------------------------------------------------------
Button id 81 ("ajuda") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end
----------------------------------------------------------------------
Button id 79 ("frases") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	clear text of recordField "titol" of page "frase"
	clear text of recordField "texte" of page "frase"
	go to page "frase"
	syscursor = 1
end	
----------------------------------------------------------------------
Field id 58 ("index") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

notifyBefore enterPage
	system ARRAY STRING itemArray[]
	
	fill itemArray with my text in [textline] order
	set my selectedTextlines to 1
	set my scroll to 0
end enterPage

to handle buttonUp

	set text of field "item" to selectedText
	un=text of field "item" of this page
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	un=text of field "item" of this page
	dos="7"&un
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page
	put un after last word of text of RecordField "primer1" of this page
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	mmClose clip vnumdibu
	mmClose clip vnumsigne
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	if text of RecordField "primerg1" of this page is not null
	sysCursor=1
	break
	else
	request "No hi ha el grāfic del signe" && un
	end if
end buttonUp


to handle sortSelf
	local ARRAY dataArray[]
	local STRING sortedText
	sysCursor = 4
	-- put the textlines into an array
	fill dataArray with my text in [textline] order
	-- sort the array
	send quickSort dataArray
	-- convert the array back into textlines
	step i from 1 to dimensions(dataArray)
		put dataArray[i] & CRLF after sortedText
	end step
	-- get rid of trailing crlf's
	clear last char of sortedText
	clear last char of sortedText
	-- update the text
	set my text to sortedText
	sysCursor = default
end sortSelf

-- The next three handlers make up a Standard recursive QuickSort.
-- Keep in mind that arrays are passed by reference, not by value.
to handle quickSort fArray[] by reference
	system s_noSwap
	set s_noSwap to 0
    send quickSrt fArray, 1, dimensions ( fArray )
end quickSort

to handle quickSrt fArray[] by reference, lo, hi
    system  s_noSwap
    if hi > lo 
		send swap  fArray, lo, ((lo+hi) div 2)
		set lst to lo
		step i from (lo+1) to hi
        	if fArray[i] < fArray[lo] as text
        		increment lst
        		send swap fArray, lst, i
        	else
        		increment s_noswap
        	end if
        end step
        send swap fArray,lo,lst 
   		send quicksrt fArray, lo, lst-1
    	send quicksrt fArray, lst+1,hi
   	end if
end quickSrt

to handle swap fArray[] by reference, x, y
	local temp
	set temp to fArray[x]
	set fArray[x] to fArray[y]
	set fArray[y] to temp
end swap


-- use if inserting a single line. Will maintain sorted order
to handle insertLine newLine
	set my text to insertLineAux(my text,newLine)
end insertLine

-- inserts newLine into txt, maintaining sorted order.
-- works only if txt is already sorted.
to get insertLineAux txt,newLine
	if txt is null
		return newLine
	end if
	set start to 1  -- first textline
	set tlc to textlinecount(txt)
	set ending to tlc -- last textline
	local insertSpot
	while start <= ending 
		set midPoint to (start+ending) div 2 
		set middleLine to textline midPoint of txt
		conditions
		when newLine < middleLine as text
			-- start looking at values less than current midPoint
			set ending to midPoint-1
			set insertSpot to midPoint
		when newLine > middleLine as text
			-- start looking at values greater than current midPoint
			set start to midPoint+1
			set insertSpot to midPoint+1
		else
			-- the item already exists
			set insertSpot to midPoint
			break while
		end conditions
	end while
	if insertSpot > tlc
		put newLine before textline insertSpot of txt
	else
		put newLine&crlf before textline insertSpot of txt
	end if
	return txt
end insertLineAux


----------------------------------------------------------------------
Button id 54 of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle buttonClick
	system vnumsigne
	mmSeek clip vnumsigne to 0 from end

end
----------------------------------------------------------------------
Button id 53 of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle doStep
	system vnumsigne
	mmStep clip vnumsigne by 50 wait

end


to handle buttonClick
	send doStep
end

to handle buttonStillDown
	send doStep
end
----------------------------------------------------------------------
Button id 52 of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle doStep
	system vnumsigne
	mmStep clip vnumsigne back by 1 wait

end


to handle buttonClick
	send doStep
end

to handle buttonStillDown
	send doStep
end
----------------------------------------------------------------------
Button id 51 of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle buttonClick
	system vnumsigne
	mmSeek clip vnumsigne to 0
end
----------------------------------------------------------------------
Button id 50 of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle buttonClick
		system vnumsigne
	mmPause clip vnumsigne
end
----------------------------------------------------------------------
Button id 49 of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle buttonClick
	system vnumsigne
	vnumsigne=text of recordfield "primer1" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage videos hold
end
----------------------------------------------------------------------
Group id 55 ("mmCOntrols") of Page id 17 (p. 2)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
----------------------------------------------------------------------
Page id 315 ("dites") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	system vtipus
	system vnumvideo
	system vnumdibu
	system mcarrega
	restore menuBar
	disable menu "Llegir" at reader
	disable menu "Pāgina" at reader
	disable menu "Ediciķ" at reader
	disable menu "Lletra" at reader
	disable menu "Categories" at reader
	disable menuItem "Dites de l'any" at reader
--	disable menuItem "Editor de text bilingüe" at reader
	disable menuItem "Importar text" at reader
	disable menuItem "Imprimir el text" at reader
	disable menuItem "Imprimir la pāgina" at reader	
	disable menuItem "Exportar pictograma del signe" at reader
		disable menuItem "Importar grups de signes" at reader
		disable menuItem "Importar filmacions de signes" at reader
		disable menuItem "Importar dibuixos d'objectes" at reader
	disable menuItem "Importar grups de signes" at reader

	if vtipus=anima
	mmOpen vnumvideo

	text of comboBox "llistat" of background "frase"= "                TRIA UN CONTE O UNA HISTŌRIA:"	
	enabled of button "pelicula" of page "frase" = false
	show stage "videos" of this page
	show group mmCOntrols of this page	
	
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	mmClose all
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	focus=field "item" of this page
	
	
	else
	hide stage "videos" of this page
	hide group mmCOntrols of this page
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page



	end if
end	

to handle leavePage
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page

	restore menuBar
	disable menu "Llegir" at reader	
	disable menu "Categories" at reader
	close viewer "videos"
	close viewer "histories"
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	mmClose all
	forward
end




----------------------------------------------------------------------
Button id 116 ("Mostrar") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	close viewer "histories"
	close viewer "videos"
	if text of recordField "texte" of page "frase" is null 
	go to page "mostra1"
	else
		if text of recordField "texte" is not null
	
	search in recordField "texte" for ","by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "("by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ")"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ";"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "-"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
		search in recordField "texte" for ":"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "!"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "CRLF"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	
		go to page "mostra1"
		syscursor = 1
	end if
	end if
end	
----------------------------------------------------------------------
Button id 115 ("gestio") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	syscursor = 4
	close viewer "histories"
	close viewer "videos"
	clear text of recordField "titol"
	clear text of recordField "texte"
	go to page "gestio"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 106 ("cercar") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end

to handle buttonClick
	system vtipus
	system vnumsigne
	system vnumdibu	
	system mgrafic

	if vtipus=anima
	sysCursor=4

	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	un=text of field "item" of this page
	dos="7"&un
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page
	put un after last word of text of RecordField "primer1" of this page
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	mmClose clip vnumdibu
	mmClose clip vnumsigne
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	sysCursor=1
	break
	
	else

	sysCursor=4
	un=text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of page "Gestio"
	put un after last word of text of RecordField primer1 of page "Gestio"
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	sysCursor=1
	break
	end if
end
----------------------------------------------------------------------
Button id 104 ("Diccionari") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		syscursor = 4	
		put text of field "index" of this page into vnoms
		clear text of recordfield "texte" of page "frase"
		put "DICCIONARI" into text of recordfield titol of page "frase"
		put vnoms into text of recordfield "texte" of page "frase"
		go to next page
		go to page mostra1
		syscursor = 1
end	
----------------------------------------------------------------------
Button id 101 ("Acabar") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		request "Voleu salvar els canvis per a properes sessions?" with "SI" or "NO" or "ANULˇLAR"
			conditions
			when It is "SI"
			syscursor = 4
			clear text of recordField "titol" of page "FRASE"
			clear text of recordField "texte" of page "FRASE"
			save changes to this book
			send exit
			when It is "NO"
			send exit
			when It is "ANULˇLAR"
			break
			end conditions
end	


	
----------------------------------------------------------------------
Field id 85 ("item") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle keyChar
	system ARRAY STRING itemArray[]
	
	local WORD itemNumber, stringLength
	local STRING string
	
	--vérifie que la matrice est initialisée
	if itemArray[1] = null
		--sinon, initialisez-la
		sendnotifyBefore enterPage to field "index"
	end if
	
	--fait suivre le caractčre tapé pour que le nouveau caractčre soit placé dans le champ
	forward
	
	--verrouille l'écran pendant la recherche de la corresondance la plus proche
	sysLockScreen = TRUE
	
	--met le texte en antémémoire pour ne pas avoir ā rechercher la propriété si souvent.
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of recordField "primer77" of this page
		mmclose all
	string = my text
	
	--stocke la longueur de la chaîne courante
	stringLength = charCount(my text)
	
	--stocke le nombre d'éléments du champ dans lequel la recherche s'effectue
	numberItems = dimensions(itemArray)
	
	--s'il y a du texte dans le champ, effectue une recherche pour trouver la correspondance 
	--la plus proche
	if stringLength > 0
		-- s'il y a un seul caractčre dans le champ, effectue une recherche binaire pour aller
		-- au début du groupe alphabétique de cette lettre
		if stringLength = 1

			get binarySearch(string)

			--sélectionne la ligne de texte trouvée et fait défiler le champ pour l'atteindre
			set selectedTextlines of field "index" to it
			set scroll of field "index" to it - 1

		--il y a plusieurs caractčres dans ce champ, donc commence la recherche séquentielle
		-- pour trouver la correspondance la plus proche
		else

			--commence ā la ligne actuellement sélectionnée qui est l'ancienne 					--correspondance la plus proche
			itemNumber = selectedTextlines of field "index"

			conditions
				
			--lorsque les premiers n caractčres de l'élément de la matrice sont inférieurs ā la 			--chaîne courante, il faut effectuer une recherche séquentielle vers le bas dans
			-- la matrice jusqu'ā ce que l'élément suivant soit supérieur ou égal ā la chaîne
			-- courante ou jusqu'ā atteindre la fin de la matrice
			when chars 1 to stringLength of itemArray[itemNumber] < string as text
				while chars 1 to stringLength of itemArray[itemNumber + 1] < string as text and \
				      itemNumber <= numberItems
					increment itemNumber
				end
				
				-- si l'on arręte la recherche parce que les chaînes sont égales, le
				-- nombre d'éléments devrait ętre incrémenté pour que la ligne égale,
				-- et non pas celle au-dessus, soit mise en surbrillance.
				if chars 1 to stringLength of itemArray[itemNumber + 1] = string as text
					increment itemNumber
				end
				
			-- lorsque les premiers n caractčres de l'élément de la matrice sont supérieurs 				-- ou égaux ā la chaîne courante, il faut effectuer une recherche séquentielle
			-- vers le haut dans la matrice jusqu'ā ce que l'élément suivant soit le premier
			-- dans la matrice ou soit l'élément < de matrice.
			when chars 1 to stringLength of itemArray[itemNumber] >= string as text
				while itemNumber > 1 and \
				  chars 1 to stringLength of itemArray[itemNumber - 1] >= string as text    
					decrement itemNumber
				end				
			end conditions
			
			--sélectionne la ligne de texte avec la correspondance la plus proche
			-- et la fait défiler
			set selectedTextlines of field "index" to itemNumber
			set scroll of field "index" to itemNumber - 1
		end if
	else
		--s'il n'y a pas de texte dans le champ, sélectionne la premičre ligne de texte
		--et la fait défiler vers le haut du champ
		set selectedTextlines of field "index" to 1
		set scroll of field "index" to 0
	end if
	sysLockScreen = FALSE
end keyChar

to get binarySearch string
	system ARRAY STRING itemArray[]
	
	--initialise les limites supérieures et inférieures et le point de départ de la recherche
	upper = dimensions (itemArray)
	lower = 1
	currentPosition = (lower + upper)  DIV 2
	
	found = FALSE
	
	-- diminue l'ampleur de la recherche jusqu'ā la découverte d'une correspondance ou jusqu'ā ce
	-- qu'il n'y a plus d'éléments ā rechercher
	while not found and (upper >= lower)
		conditions
		-- lorsque la chaîne est inférieure ā l'élément de la matrice, les éléments situés 				-- au-dessus de l'élément de la matrice sont éliminés et la recherche s'effectue				-- sur la moitié inférieure
		when string < char 1 of itemArray[currentPosition] as text
			upper = currentPosition - 1
			currentPosition = (lower + upper) DIV 2
			
		-- lorsque la chaîne est supérieure ā l'élément de la matrice, les éléments situés 
		--au-dessous de l'élément de la matrice sont éliminés et la recherche s'effectue
		-- sur la moitié supérieure
		when string > char 1 of itemArray[currentPosition] as text
			lower = currentPosition + 1
			currentPosition = (lower + upper) DIV 2
		else
		--soit nous avons une correspondance, soit la chaîne ne se trouve pas dans la matrice
			found = TRUE
		end conditions
	end while

	--si la recherche est arrętée parce que la correspondance exacte n'est pas trouvée, il faut
	--vérifier s'il est nécessaire d'aller d'un élément plus loin car l'élément aprčs lequel
	--la chaîne devrait aller est sélectionné dans la chaîne sans correspondance.
	if not found and string > char 1 of itemArray[currentPosition] as text
		increment currentPosition
	end if

	--nous devons nous assurer de sélectionner le premier élément qui correspond ā la chaîne,
	--ainsi, lorsqu'une correspondance est trouvée, il faut se déplacer vers le haut de la matrice
	--pour trouver l'élément.
	while currentPosition > 1 and string = char 1 of itemArray[currentPosition - 1] as text
		decrement currentPosition
	end while
	return currentPosition
end binarySearch
----------------------------------------------------------------------
Button id 81 ("ajuda") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end
----------------------------------------------------------------------
Button id 79 ("frases") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	clear text of recordField "titol" of page "frase"
	clear text of recordField "texte" of page "frase"
	go to page "frase"
	syscursor = 1
end	
----------------------------------------------------------------------
Field id 58 ("index") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

notifyBefore enterPage
	system ARRAY STRING itemArray[]
	
	fill itemArray with my text in [textline] order
	set my selectedTextlines to 1
	set my scroll to 0
end enterPage

to handle buttonUp

	set text of field "item" to selectedText
	un=text of field "item" of this page
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	un=text of field "item" of this page
	dos="7"&un
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page
	put un after last word of text of RecordField "primer1" of this page
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	mmClose clip vnumdibu
	mmClose clip vnumsigne
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	sysCursor=1
	break
end buttonUp


to handle sortSelf
	local ARRAY dataArray[]
	local STRING sortedText
	sysCursor = 4
	-- put the textlines into an array
	fill dataArray with my text in [textline] order
	-- sort the array
	send quickSort dataArray
	-- convert the array back into textlines
	step i from 1 to dimensions(dataArray)
		put dataArray[i] & CRLF after sortedText
	end step
	-- get rid of trailing crlf's
	clear last char of sortedText
	clear last char of sortedText
	-- update the text
	set my text to sortedText
	sysCursor = default
end sortSelf

-- The next three handlers make up a Standard recursive QuickSort.
-- Keep in mind that arrays are passed by reference, not by value.
to handle quickSort fArray[] by reference
	system s_noSwap
	set s_noSwap to 0
    send quickSrt fArray, 1, dimensions ( fArray )
end quickSort

to handle quickSrt fArray[] by reference, lo, hi
    system  s_noSwap
    if hi > lo 
		send swap  fArray, lo, ((lo+hi) div 2)
		set lst to lo
		step i from (lo+1) to hi
        	if fArray[i] < fArray[lo] as text
        		increment lst
        		send swap fArray, lst, i
        	else
        		increment s_noswap
        	end if
        end step
        send swap fArray,lo,lst 
   		send quicksrt fArray, lo, lst-1
    	send quicksrt fArray, lst+1,hi
   	end if
end quickSrt

to handle swap fArray[] by reference, x, y
	local temp
	set temp to fArray[x]
	set fArray[x] to fArray[y]
	set fArray[y] to temp
end swap


-- use if inserting a single line. Will maintain sorted order
to handle insertLine newLine
	set my text to insertLineAux(my text,newLine)
end insertLine

-- inserts newLine into txt, maintaining sorted order.
-- works only if txt is already sorted.
to get insertLineAux txt,newLine
	if txt is null
		return newLine
	end if
	set start to 1  -- first textline
	set tlc to textlinecount(txt)
	set ending to tlc -- last textline
	local insertSpot
	while start <= ending 
		set midPoint to (start+ending) div 2 
		set middleLine to textline midPoint of txt
		conditions
		when newLine < middleLine as text
			-- start looking at values less than current midPoint
			set ending to midPoint-1
			set insertSpot to midPoint
		when newLine > middleLine as text
			-- start looking at values greater than current midPoint
			set start to midPoint+1
			set insertSpot to midPoint+1
		else
			-- the item already exists
			set insertSpot to midPoint
			break while
		end conditions
	end while
	if insertSpot > tlc
		put newLine before textline insertSpot of txt
	else
		put newLine&crlf before textline insertSpot of txt
	end if
	return txt
end insertLineAux


----------------------------------------------------------------------
Button id 54 of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle buttonClick
	system vnumsigne
	mmSeek clip vnumsigne to 0 from end

end
----------------------------------------------------------------------
Button id 53 of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle doStep
	system vnumsigne
	mmStep clip vnumsigne by 50 wait

end


to handle buttonClick
	send doStep
end

to handle buttonStillDown
	send doStep
end
----------------------------------------------------------------------
Button id 52 of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle doStep
	system vnumsigne
	mmStep clip vnumsigne back by 1 wait

end


to handle buttonClick
	send doStep
end

to handle buttonStillDown
	send doStep
end
----------------------------------------------------------------------
Button id 51 of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle buttonClick
	system vnumsigne
	mmSeek clip vnumsigne to 0
end
----------------------------------------------------------------------
Button id 50 of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle buttonClick
		system vnumsigne
	mmPause clip vnumsigne
end
----------------------------------------------------------------------
Button id 49 of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle buttonClick
	system vnumsigne
	vnumsigne=text of recordfield "primer1" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage videos hold
end
----------------------------------------------------------------------
Group id 55 ("mmCOntrols") of Page id 315 (p. 3)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
----------------------------------------------------------------------
Page id 318 ("vocvideo") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	system vtipus
	system vnumvideo
	system vnumdibu
	system mcarrega
	restore menuBar
	disable menu "Llegir" at reader
	disable menu "Pāgina" at reader
	disable menu "Ediciķ" at reader
	disable menu "Lletra" at reader
	disable menu "Categories" at reader
	disable menuItem "Vídeos de signes" at reader
--	disable menuItem "Editor de text bilingüe" at reader
	disable menuItem "Importar text" at reader
	disable menuItem "Imprimir el text" at reader
	disable menuItem "Imprimir la pāgina" at reader	
	disable menuItem "Exportar pictograma del signe" at reader
		disable menuItem "Importar grups de signes" at reader
		disable menuItem "Importar filmacions de signes" at reader
		disable menuItem "Importar dibuixos d'objectes" at reader
	disable menuItem "Importar grups de signes" at reader

	if vtipus=anima
	mmOpen vnumvideo

	text of comboBox "llistat" of background "frase"= "                TRIA UN CONTE O UNA HISTŌRIA:"	
	enabled of button "pelicula" of page "frase" = false
	show stage "videos" of this page
	show group mmCOntrols of this page	
	
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	mmClose all
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	focus=field "item" of this page
	
	
	else
	hide stage "videos" of this page
	hide group mmCOntrols of this page
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page



	end if
end	

to handle leavePage
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page

	restore menuBar
	disable menu "Llegir" at reader	
	disable menu "Categories" at reader
	close viewer "videos"
	close viewer "histories"
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	mmClose all	
	forward
end




----------------------------------------------------------------------
Button id 119 ("Mostrar") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	close viewer "histories"
	close viewer "videos"
	if text of recordField "texte" of page "frase" is null 
	go to page "mostra1"
	else
		if text of recordField "texte" is not null
	
	search in recordField "texte" for ","by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "("by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ")"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ";"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "-"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
		search in recordField "texte" for ":"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "!"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "CRLF"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	
		go to page "mostra1"
		syscursor = 1
	end if
	end if
end	
----------------------------------------------------------------------
Button id 118 ("gestio") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	syscursor = 4
	close viewer "histories"
	close viewer "videos"
	clear text of recordField "titol"
	clear text of recordField "texte"
	go to page "gestio"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 117 ("frases") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	clear text of recordField "titol" of page "frase"
	clear text of recordField "texte" of page "frase"
	go to page "frase"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 106 ("cercar") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end

to handle buttonClick
	system vtipus
	system vnumsigne
	system vnumdibu	
	system mgrafic

	if vtipus=anima
	sysCursor=4

	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	un=text of field "item" of this page
	dos="7"&un
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page
	put un after last word of text of RecordField "primer1" of this page
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	mmClose clip vnumdibu
	mmClose clip vnumsigne
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	sysCursor=1
	break
	
	else

	sysCursor=4
	un=text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of page "Gestio"
	put un after last word of text of RecordField primer1 of page "Gestio"
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	sysCursor=1
	break
	end if
end
----------------------------------------------------------------------
Button id 104 ("Diccionari") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		syscursor = 4	
		put text of field "index" of this page into vnoms
		clear text of recordfield "texte" of page "frase"
		put "DICCIONARI" into text of recordfield titol of page "frase"
		put vnoms into text of recordfield "texte" of page "frase"
		go to next page
		go to page mostra1
		syscursor = 1
end	
----------------------------------------------------------------------
Button id 101 ("Acabar") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		request "Voleu salvar els canvis per a properes sessions?" with "SI" or "NO" or "ANULˇLAR"
			conditions
			when It is "SI"
			syscursor = 4
			clear text of recordField "titol" of page "FRASE"
			clear text of recordField "texte" of page "FRASE"
			save changes to this book
			send exit
			when It is "NO"
			send exit
			when It is "ANULˇLAR"
			break
			end conditions
end	


	
----------------------------------------------------------------------
Field id 85 ("item") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle keyChar
	system ARRAY STRING itemArray[]
	
	local WORD itemNumber, stringLength
	local STRING string
	
	--vérifie que la matrice est initialisée
	if itemArray[1] = null
		--sinon, initialisez-la
		sendnotifyBefore enterPage to field "index"
	end if
	
	--fait suivre le caractčre tapé pour que le nouveau caractčre soit placé dans le champ
	forward
	
	--verrouille l'écran pendant la recherche de la corresondance la plus proche
	sysLockScreen = TRUE
	
	--met le texte en antémémoire pour ne pas avoir ā rechercher la propriété si souvent.
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of recordField "primer77" of this page
		mmclose all
	string = my text
	
	--stocke la longueur de la chaîne courante
	stringLength = charCount(my text)
	
	--stocke le nombre d'éléments du champ dans lequel la recherche s'effectue
	numberItems = dimensions(itemArray)
	
	--s'il y a du texte dans le champ, effectue une recherche pour trouver la correspondance 
	--la plus proche
	if stringLength > 0
		-- s'il y a un seul caractčre dans le champ, effectue une recherche binaire pour aller
		-- au début du groupe alphabétique de cette lettre
		if stringLength = 1

			get binarySearch(string)

			--sélectionne la ligne de texte trouvée et fait défiler le champ pour l'atteindre
			set selectedTextlines of field "index" to it
			set scroll of field "index" to it - 1

		--il y a plusieurs caractčres dans ce champ, donc commence la recherche séquentielle
		-- pour trouver la correspondance la plus proche
		else

			--commence ā la ligne actuellement sélectionnée qui est l'ancienne 					--correspondance la plus proche
			itemNumber = selectedTextlines of field "index"

			conditions
				
			--lorsque les premiers n caractčres de l'élément de la matrice sont inférieurs ā la 			--chaîne courante, il faut effectuer une recherche séquentielle vers le bas dans
			-- la matrice jusqu'ā ce que l'élément suivant soit supérieur ou égal ā la chaîne
			-- courante ou jusqu'ā atteindre la fin de la matrice
			when chars 1 to stringLength of itemArray[itemNumber] < string as text
				while chars 1 to stringLength of itemArray[itemNumber + 1] < string as text and \
				      itemNumber <= numberItems
					increment itemNumber
				end
				
				-- si l'on arręte la recherche parce que les chaînes sont égales, le
				-- nombre d'éléments devrait ętre incrémenté pour que la ligne égale,
				-- et non pas celle au-dessus, soit mise en surbrillance.
				if chars 1 to stringLength of itemArray[itemNumber + 1] = string as text
					increment itemNumber
				end
				
			-- lorsque les premiers n caractčres de l'élément de la matrice sont supérieurs 				-- ou égaux ā la chaîne courante, il faut effectuer une recherche séquentielle
			-- vers le haut dans la matrice jusqu'ā ce que l'élément suivant soit le premier
			-- dans la matrice ou soit l'élément < de matrice.
			when chars 1 to stringLength of itemArray[itemNumber] >= string as text
				while itemNumber > 1 and \
				  chars 1 to stringLength of itemArray[itemNumber - 1] >= string as text    
					decrement itemNumber
				end				
			end conditions
			
			--sélectionne la ligne de texte avec la correspondance la plus proche
			-- et la fait défiler
			set selectedTextlines of field "index" to itemNumber
			set scroll of field "index" to itemNumber - 1
		end if
	else
		--s'il n'y a pas de texte dans le champ, sélectionne la premičre ligne de texte
		--et la fait défiler vers le haut du champ
		set selectedTextlines of field "index" to 1
		set scroll of field "index" to 0
	end if
	sysLockScreen = FALSE
end keyChar

to get binarySearch string
	system ARRAY STRING itemArray[]
	
	--initialise les limites supérieures et inférieures et le point de départ de la recherche
	upper = dimensions (itemArray)
	lower = 1
	currentPosition = (lower + upper)  DIV 2
	
	found = FALSE
	
	-- diminue l'ampleur de la recherche jusqu'ā la découverte d'une correspondance ou jusqu'ā ce
	-- qu'il n'y a plus d'éléments ā rechercher
	while not found and (upper >= lower)
		conditions
		-- lorsque la chaîne est inférieure ā l'élément de la matrice, les éléments situés 				-- au-dessus de l'élément de la matrice sont éliminés et la recherche s'effectue				-- sur la moitié inférieure
		when string < char 1 of itemArray[currentPosition] as text
			upper = currentPosition - 1
			currentPosition = (lower + upper) DIV 2
			
		-- lorsque la chaîne est supérieure ā l'élément de la matrice, les éléments situés 
		--au-dessous de l'élément de la matrice sont éliminés et la recherche s'effectue
		-- sur la moitié supérieure
		when string > char 1 of itemArray[currentPosition] as text
			lower = currentPosition + 1
			currentPosition = (lower + upper) DIV 2
		else
		--soit nous avons une correspondance, soit la chaîne ne se trouve pas dans la matrice
			found = TRUE
		end conditions
	end while

	--si la recherche est arrętée parce que la correspondance exacte n'est pas trouvée, il faut
	--vérifier s'il est nécessaire d'aller d'un élément plus loin car l'élément aprčs lequel
	--la chaîne devrait aller est sélectionné dans la chaîne sans correspondance.
	if not found and string > char 1 of itemArray[currentPosition] as text
		increment currentPosition
	end if

	--nous devons nous assurer de sélectionner le premier élément qui correspond ā la chaîne,
	--ainsi, lorsqu'une correspondance est trouvée, il faut se déplacer vers le haut de la matrice
	--pour trouver l'élément.
	while currentPosition > 1 and string = char 1 of itemArray[currentPosition - 1] as text
		decrement currentPosition
	end while
	return currentPosition
end binarySearch
----------------------------------------------------------------------
Button id 81 ("ajuda") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end
----------------------------------------------------------------------
Field id 58 ("index") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

notifyBefore enterPage
	system ARRAY STRING itemArray[]
	
	fill itemArray with my text in [textline] order
	set my selectedTextlines to 1
	set my scroll to 0
end enterPage

to handle buttonUp

	set text of field "item" to selectedText
	un=text of field "item" of this page
	mmPlay clip signe2 in stage "videos" of this page
	mmPlay clip signe2p in stage "dibuix" of this page
	un=text of field "item" of this page
	dos="7"&un
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	insert graphic bitmap un after last word of text of RecordField "primerg1" of this page
	put un after last word of text of RecordField "primer1" of this page
	put text of recordfield "primer1" of this page into vnumsigne
	put dos into vnumdibu
	mmClose clip vnumdibu
	mmClose clip vnumsigne
	mmPlay clip vnumdibu in stage "dibuix" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage "videos" of this page
	mmSeek clip vnumsigne to 0
	sysCursor=1
	break
end buttonUp


to handle sortSelf
	local ARRAY dataArray[]
	local STRING sortedText
	sysCursor = 4
	-- put the textlines into an array
	fill dataArray with my text in [textline] order
	-- sort the array
	send quickSort dataArray
	-- convert the array back into textlines
	step i from 1 to dimensions(dataArray)
		put dataArray[i] & CRLF after sortedText
	end step
	-- get rid of trailing crlf's
	clear last char of sortedText
	clear last char of sortedText
	-- update the text
	set my text to sortedText
	sysCursor = default
end sortSelf

-- The next three handlers make up a Standard recursive QuickSort.
-- Keep in mind that arrays are passed by reference, not by value.
to handle quickSort fArray[] by reference
	system s_noSwap
	set s_noSwap to 0
    send quickSrt fArray, 1, dimensions ( fArray )
end quickSort

to handle quickSrt fArray[] by reference, lo, hi
    system  s_noSwap
    if hi > lo 
		send swap  fArray, lo, ((lo+hi) div 2)
		set lst to lo
		step i from (lo+1) to hi
        	if fArray[i] < fArray[lo] as text
        		increment lst
        		send swap fArray, lst, i
        	else
        		increment s_noswap
        	end if
        end step
        send swap fArray,lo,lst 
   		send quicksrt fArray, lo, lst-1
    	send quicksrt fArray, lst+1,hi
   	end if
end quickSrt

to handle swap fArray[] by reference, x, y
	local temp
	set temp to fArray[x]
	set fArray[x] to fArray[y]
	set fArray[y] to temp
end swap


-- use if inserting a single line. Will maintain sorted order
to handle insertLine newLine
	set my text to insertLineAux(my text,newLine)
end insertLine

-- inserts newLine into txt, maintaining sorted order.
-- works only if txt is already sorted.
to get insertLineAux txt,newLine
	if txt is null
		return newLine
	end if
	set start to 1  -- first textline
	set tlc to textlinecount(txt)
	set ending to tlc -- last textline
	local insertSpot
	while start <= ending 
		set midPoint to (start+ending) div 2 
		set middleLine to textline midPoint of txt
		conditions
		when newLine < middleLine as text
			-- start looking at values less than current midPoint
			set ending to midPoint-1
			set insertSpot to midPoint
		when newLine > middleLine as text
			-- start looking at values greater than current midPoint
			set start to midPoint+1
			set insertSpot to midPoint+1
		else
			-- the item already exists
			set insertSpot to midPoint
			break while
		end conditions
	end while
	if insertSpot > tlc
		put newLine before textline insertSpot of txt
	else
		put newLine&crlf before textline insertSpot of txt
	end if
	return txt
end insertLineAux


----------------------------------------------------------------------
Button id 54 of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle buttonClick
	system vnumsigne
	mmSeek clip vnumsigne to 0 from end

end
----------------------------------------------------------------------
Button id 53 of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle doStep
	system vnumsigne
	mmStep clip vnumsigne by 50 wait

end


to handle buttonClick
	send doStep
end

to handle buttonStillDown
	send doStep
end
----------------------------------------------------------------------
Button id 52 of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle doStep
	system vnumsigne
	mmStep clip vnumsigne back by 1 wait

end


to handle buttonClick
	send doStep
end

to handle buttonStillDown
	send doStep
end
----------------------------------------------------------------------
Button id 51 of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle buttonClick
	system vnumsigne
	mmSeek clip vnumsigne to 0
end
----------------------------------------------------------------------
Button id 50 of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle buttonClick
		system vnumsigne
	mmPause clip vnumsigne
end
----------------------------------------------------------------------
Button id 49 of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle buttonClick
	system vnumsigne
	vnumsigne=text of recordfield "primer1" of this page
	mmOpen clip vnumsigne
	mmPlay clip vnumsigne in stage videos hold
end
----------------------------------------------------------------------
Group id 55 ("mmCOntrols") of Page id 318 (p. 4)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
----------------------------------------------------------------------
ComboBox id 27 ("llistat") of Background id 8
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle selectChange indret
	system mcarrega
	system vnumvideo
	close viewer "histories"
	close viewer "videos"
	mmClose all
	sysCursor=4
	put indret into mcarrega
	
	dades="\signe2\contes\"&mcarrega&"."&"txt"
	
	mmOpen clip mcarrega
	clear text of recordField "titol"
	clear text of recordField "texte"
	if indret is not "                TRIA UN CONTE O UNA HISTŌRIA:"
	put indret into text of recordField titol
	else
	end if
	OpenFile dades
	readFile dades for 24242
	closeFile dades
	dades=it
	put space & It after text of recordField "texte" of page "frase"
	closeFile dades
	enabled of button "pelicula" of this page = true
	sysCursor=1
end		
	
----------------------------------------------------------------------
Page id 18 ("FRASE") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	system vtipus
	system vnumvideo
	system mcarrega
	restore menuBar
	enable menuItem "Llegir" at reader
	disable menu "Pāgina" at reader
	disable menuItem "Editor de frases" at reader
	disable menuItem "Imprimir el text" at reader
	disable menuItem "Imprimir la pāgina" at reader	
	disable menuItem "Importar dibuixos d'objectes" at reader
	disable menuItem "Importar filmacions de signes" at reader
	disable menuItem "Exportar pictograma del signe" at reader
	disable menuItem "Importar grups de signes" at reader
	clear text of recordField "solucio" of this page

	if vtipus=anima
	mmOpen vnumvideo
	
	show combobox "llistat" of this background
	show button "pelicula" of this page
	show button "contes" of this page
	else
	hide combobox "llistat" of this background
	hide button "pelicula" of this page
	hide button "contes" of this page
		
	hide group visual of this background
	hide group visual1 of this background
	
	sysPageScroll=0,0

	put text of recordfield titol into comprova
	if comprova is not in mmllista
	enabled of button "pelicula" of this page = false
	else
	end if
	selectedItem of comboBox "llistat" of this background=1
	focus=recordfield "titol" of this page
	forward
	end if

end	
	

to handle leavePage
	restore menuBar
	disable menu "Llegir" at reader	
	disable menu "Categories" at reader
	close viewer "videos"
	close viewer "histories"
	mmClose all
	forward
end




----------------------------------------------------------------------
Button id 54 ("Acabar") of Page id 18 (p. 5)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		request "Voleu salvar els canvis per a properes sessions?" with "SI" or "NO" or "ANULˇLAR"
			conditions
			when It is "SI"
			syscursor = 4
			clear text of recordField "titol" of page "FRASE"
			clear text of recordField "texte" of page "FRASE"
			save changes to this book
			send exit
			when It is "NO"
			send exit
			when It is "ANULˇLAR"
			break
			end conditions
end	


	
----------------------------------------------------------------------
Button id 53 ("llegir") of Page id 18 (p. 5)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
to handle buttonClick
	sysCursor=4
	system vtipus
	send lectura
	sysCursor=1
end
----------------------------------------------------------------------
Button id 51 ("ajuda") of Page id 18 (p. 5)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end
----------------------------------------------------------------------
Button id 49 ("gestio") of Page id 18 (p. 5)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	syscursor = 4
	close viewer "histories"
	close viewer "videos"
	clear text of recordField "titol"
	clear text of recordField "texte"
	go to page "gestio"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 48 ("importar") of Page id 18 (p. 5)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick

	system sLastResPlayed
	close viewer "histories"
	close viewer "videos"

	linkDll "tbdlg.dll"
		STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
	end linkDll
	
	strCaption = "Importar un text"
	strFilterList = ""
	
	push "Tots els fitxers (*.*),*.*" onto strFilterList
	push "TXT(.Txt),*.txt" onto strFilterList
	get OpenFileDlg(strCaption,"","",strFilterList,1)
	

	if (it is not null)

	clear text of recordField "titol"
	clear text of recordField "texte"
	mmClose all
	enabled of button "pelicula" of this page = false
	selectedItem of comboBox "llistat" of this background=1
	dades=It
	OpenFile dades
	readFile dades for 24242
	closeFile dades
	dades=it
	put space & It after text of recordField "texte" of page "frase"
	closeFile dades
	end if
	search in recordField "texte" for ","by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "("by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ")"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ";"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "-"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ":"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "!"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "CRLF"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "/"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
end
----------------------------------------------------------------------
Button id 47 ("Nou") of Page id 18 (p. 5)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	close viewer "histories"
	close viewer "videos"
	if text of recordField "texte" of page "frase" is not null 
	syscursor = 4
	request "Comenįar un nou document i perdre l'actual text?" with "SI" or "NO"
	conditions
	when It is "SI"
	clear text of recordField "titol"
	clear text of recordField "texte"
	mmClose all
	enabled of button "pelicula" of this page = false
	selectedItem of comboBox "llistat" of this background=1
	end conditions
	focus=recordfield "titol" of this page
	syscursor = 1
	end if
end
----------------------------------------------------------------------
Button id 46 ("Mostrar") of Page id 18 (p. 5)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	close viewer "histories"
	close viewer "videos"
	if text of recordField "texte" of page "frase" is null 
	go to page "mostra1"
	else
		if text of recordField "texte" is not null
	
	search in recordField "texte" for ","by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "("by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ")"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for ";"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "-"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
		search in recordField "texte" for ":"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "!"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	search in recordField "texte" for "CRLF"by case
	while "not found" is not in sysError
	send clear
	search again
	end while
	
		go to page "mostra1"
		syscursor = 1
	end if
	end if
end	
----------------------------------------------------------------------
Button id 45 ("pelicula") of Page id 18 (p. 5)
----------------------------------------------------------------------
to handle mouseEnter
	if 	enabled of button "pelicula" of this page = false
	sysCursor=1
	else
	sysCursor=44
	end if
end

to handle mouseleave
	sysCursor=1
end	


to handle buttonClick
	sysCursor=4
	system mcarrega
	system vnumvideo
	close viewer "histories"
	put mcarrega into vnumvideo
	show viewer "videos"
	sysCursor=1
end	

----------------------------------------------------------------------
Background id 9 ("mostra") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterBackground
	system mmester
	enable menu "Llegir" at reader
	disable menuItem "Importar text" at reader
	disable menuItem "Editor de text bilingüe" at reader
	disable menuItem "Importar dibuixos d'objectes" at reader
	disable menuItem "Importar filmacions de signes" at reader
	disable menuItem "Exportar pictograma del signe" at reader
	disable menuItem "Importar grups de signes" at reader
	disable menu "Llegir" at reader
	mmester=0
	forward
end	

to handle leaveBackground
	restore menuBar

	clear text of field "titol1" of page "mostra1"
	step i from 1 to pageCount of background "mostra"
	if text of recordField "para1" = null
	break
	else

	nombrep=1
	step nombre from 1 to 42
	paraulap="para"&nombrep
	quadrep="parag"&nombrep
	clear text of recordField paraulap of page i of this background
	clear text of recordField quadrep of page i of this background
	nombrep=nombrep+1
	end step
	end if
	end step
	clear mmester
	forward
end
----------------------------------------------------------------------
Button id 176 ("Acabar") of Background id 9
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		request "Voleu salvar els canvis per a properes sessions?" with "SI" or "NO" or "ANULˇLAR"
			conditions
			when It is "SI"
			syscursor = 4
			clear text of recordField "titol" of page "FRASE"
			clear text of recordField "texte" of page "FRASE"
			save changes to this book
			send exit
			when It is "NO"
			send exit
			when It is "ANULˇLAR"
			break
			end conditions
end	


	
----------------------------------------------------------------------
Button id 174 ("imprimir") of Background id 9
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick

	request " Seleccioneu l'opciķ a imprimir. Per imprimir tot el text cal anar abans, pāgina a pāgina, fins el darrer full amb text. Heu de configurar la impressora en l'orientaciķ vertical" with "PĀGINA" or "TOT EL TEXT" or "CONFIGURAR"

	if it is "CONFIGURAR" then
	sysCursor = 4
	send printsetup
	sysCursor = 1
	end if
	
	if it is "PĀGINA" then
	
	hide button "gestio" of this background
	hide button "imprimir" of this background
	hide button "frases" of this background
	hide button "seguent" of this background
	hide button "anterior" of this background
	hide button "acabar" of this background
	fillColor of this background=white
	start spooler
		print 1 pages 
	end spooler
	show button "gestio" of this background
	show button "imprimir" of this background
	show button "frases" of this background
	show button "seguent" of this background
	show button "anterior" of this background
	show button "acabar" of this background
	
	end if
	
	if it is "TOT EL TEXT" then
		hide button "gestio" of this background
	hide button "imprimir" of this background
	hide button "frases" of this background
	hide button "seguent" of this background
	hide button "anterior" of this background
	hide button "categoria" of this background
	fillColor of this background=white
	start spooler
		go to page "mostra1"
		print 128 pages 
	end spooler
	show button "gestio" of this background
	show button "imprimir" of this background
	show button "frases" of this background
	show button "seguent" of this background
	show button "anterior" of this background
	show button "categoria" of this background
	
	end if
	
end	


----------------------------------------------------------------------
Button id 173 ("gestio") of Background id 9
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	syscursor = 4
	clear text of recordField "titol"
	clear text of recordField "texte"
	go to page "gestio"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 172 ("frases") of Background id 9
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	go to page "frase"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 171 ("Seguent") of Background id 9
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	system mparaula
	if this page is last page of this background
	request "És la última pāgina"
	else
	if text of recordField para42 is null
	request "No hi ha més pāgines de text"
	else
	syscursor = 4	
	mparaula=mparaula+42
	go to next page

	sysPageScroll= 0,0
	syscursor = 1
	end if
	end if
end	
----------------------------------------------------------------------
Button id 170 ("Anterior") of Background id 9
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	system mparaula
	if this page is not page "mostra1"
	syscursor = 4
	mparaula=mparaula-42
	go to previous page
	
	sysPageScroll= 0,0
	syscursor = 1
	else
	request "És la primera pāgina"
	end if
end	
----------------------------------------------------------------------
RecordField id 164 ("para42") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag42" of this page
		insert graphic bitmap aa into text of RecordField "parag42" of this page
		if text of recordField "parag42" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag42" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 161 ("para41") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag41" of this page
		insert graphic bitmap aa into text of RecordField "parag41" of this page
		if text of recordField "parag41" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag41" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 159 ("para40") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag40" of this page
		insert graphic bitmap aa into text of RecordField "parag40" of this page
		if text of recordField "parag40" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag40" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 157 ("para39") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag39" of this page
		insert graphic bitmap aa into text of RecordField "parag39" of this page
		if text of recordField "parag39" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag39" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 155 ("para38") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag38" of this page
		insert graphic bitmap aa into text of RecordField "parag38" of this page
		if text of recordField "parag38" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag38" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 153 ("para37") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag37" of this page
		insert graphic bitmap aa into text of RecordField "parag37" of this page
		if text of recordField "parag37" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag37" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 151 ("para36") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag36" of this page
		insert graphic bitmap aa into text of RecordField "parag36" of this page
		if text of recordField "parag36" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag36" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 149 ("para35") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag35" of this page
		insert graphic bitmap aa into text of RecordField "parag35" of this page
		if text of recordField "parag35" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag35" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 147 ("para34") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag34" of this page
		insert graphic bitmap aa into text of RecordField "parag34" of this page
		if text of recordField "parag34" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag34" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 145 ("para33") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag33" of this page
		insert graphic bitmap aa into text of RecordField "parag33" of this page
		if text of recordField "parag33" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag33" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 89 ("para32") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag32" of this page
		insert graphic bitmap aa into text of RecordField "parag32" of this page
		if text of recordField "parag32" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag32" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 88 ("para31") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag31" of this page
		insert graphic bitmap aa into text of RecordField "parag31" of this page
		if text of recordField "parag31" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag31" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 87 ("para30") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag30" of this page
		insert graphic bitmap aa into text of RecordField "parag30" of this page
		if text of recordField "parag30" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag30" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 86 ("para29") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag29" of this page
		insert graphic bitmap aa into text of RecordField "parag29" of this page
		if text of recordField "parag29" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag29" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 85 ("para28") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag28" of this page
		insert graphic bitmap aa into text of RecordField "parag28" of this page
		if text of recordField "parag28" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag28" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 84 ("para27") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag27" of this page
		insert graphic bitmap aa into text of RecordField "parag27" of this page
		if text of recordField "parag27" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag27" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 83 ("para26") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag26" of this page
		insert graphic bitmap aa into text of RecordField "parag26" of this page
		if text of recordField "parag26" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag26" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 82 ("para25") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag25" of this page
		insert graphic bitmap aa into text of RecordField "parag25" of this page
		if text of recordField "parag25" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag25" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 81 ("para24") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag24" of this page
		insert graphic bitmap aa into text of RecordField "parag24" of this page
		if text of recordField "parag24" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag24" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 80 ("para23") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag23" of this page
		insert graphic bitmap aa into text of RecordField "parag23" of this page
		if text of recordField "parag23" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag23" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 79 ("para22") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag22" of this page
		insert graphic bitmap aa into text of RecordField "parag22" of this page
		if text of recordField "parag22" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag22" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 78 ("para21") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag21" of this page
		insert graphic bitmap aa into text of RecordField "parag21" of this page
		if text of recordField "parag21" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag21" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 77 ("para20") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag20" of this page
		insert graphic bitmap aa into text of RecordField "parag20" of this page
		if text of recordField "parag20" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag20" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 76 ("para19") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag19" of this page
		insert graphic bitmap aa into text of RecordField "parag19" of this page
		if text of recordField "parag19" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag19" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 75 ("para18") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag18" of this page
		insert graphic bitmap aa into text of RecordField "parag18" of this page
		if text of recordField "parag18" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag18" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 74 ("para17") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag17" of this page
		insert graphic bitmap aa into text of RecordField "parag17" of this page
		if text of recordField "parag17" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag17" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 73 ("para16") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag16" of this page
		insert graphic bitmap aa into text of RecordField "parag16" of this page
		if text of recordField "parag16" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag16" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 72 ("para15") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag15" of this page
		insert graphic bitmap aa into text of RecordField "parag15" of this page
		if text of recordField "parag15" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag15" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 71 ("para14") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag14" of this page
		insert graphic bitmap aa into text of RecordField "parag14" of this page
		if text of recordField "parag14" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag14" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 70 ("para13") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag13" of this page
		insert graphic bitmap aa into text of RecordField "parag13" of this page
		if text of recordField "parag13" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag13" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown

----------------------------------------------------------------------
RecordField id 69 ("para12") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag12" of this page
		insert graphic bitmap aa into text of RecordField "parag12" of this page
		if text of recordField "parag12" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag12" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown

----------------------------------------------------------------------
RecordField id 68 ("para11") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag11" of this page
		insert graphic bitmap aa into text of RecordField "parag11" of this page
		if text of recordField "parag11" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag11" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown

----------------------------------------------------------------------
RecordField id 67 ("para10") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag10" of this page
		insert graphic bitmap aa into text of RecordField "parag10" of this page
		if text of recordField "parag10" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag10" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown

----------------------------------------------------------------------
RecordField id 66 ("para9") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag9" of this page
		insert graphic bitmap aa into text of RecordField "parag9" of this page
		if text of recordField "parag9" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag9" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown

----------------------------------------------------------------------
RecordField id 65 ("para8") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag8" of this page
		insert graphic bitmap aa into text of RecordField "parag8" of this page
		if text of recordField "parag8" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag8" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 64 ("para7") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag7" of this page
		insert graphic bitmap aa into text of RecordField "parag7" of this page
		if text of recordField "parag7" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag7" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 63 ("para6") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag6" of this page
		insert graphic bitmap aa into text of RecordField "parag6" of this page
		if text of recordField "parag6" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag6" of this page
	forward
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 62 ("para5") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag5" of this page
		insert graphic bitmap aa into text of RecordField "parag5" of this page
		if text of recordField "parag5" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag5" of this page
	forward
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 61 ("para4") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag4" of this page
		insert graphic bitmap aa into text of RecordField "parag4" of this page
		if text of recordField "parag4" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag4" of this page
	forward
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 59 ("para3") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag3" of this page
		insert graphic bitmap aa into text of RecordField "parag3" of this page
		if text of recordField "parag3" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag3" of this page
	forward
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 58 ("para2") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	clear It
	conditions
	when key = keyTab

		get text of self
		put It into aa
		clear text of recordfield "parag2" of this page
		insert graphic bitmap aa into text of RecordField "parag2" of this page
		if text of recordField "parag2" is null
	
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag2" of this page
	forward
	forward
	end if
	end if
	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
--	clear text of recordfield "texte" of page "frase"
	put " "&&aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

--	forward
	clear aa
end keyDown
----------------------------------------------------------------------
RecordField id 2 ("para1") of Background id 9
----------------------------------------------------------------------
 to handle keyDown key
	system mgrafic
	fontface of self=sysfontFace
	fontSize of self=sysfontSize
	fontStyle of self=sysfontStyle
	conditions
	when key = keyTab
		get text of self
		put It into aa
		clear text of recordfield "parag1" of this page
		insert graphic bitmap aa into text of RecordField "parag1" of this page
		if text of recordField "parag1" is null
		
		
	clear mgrafic
	clear meu1
	
	ae=text of recordField "recerca1" of page "recercat1" of this book
	push text of recordField "recerca2" of page "recercat1" of this book onto ae
	fk=text of recordField "recerca1" of page "recercat2" of this book
	push text of recordField "recerca2" of page "recercat2" of this book onto fk
	lņ=text of recordField "recerca1" of page "recercat3" of this book
	push text of recordField "recerca2" of page "recercat3" of this book onto lņ
	op=text of recordField "recerca1" of page "recercat4" of this book
	push text of recordField "recerca2" of page "recercat4" of this book onto ot	
	rt=text of recordField "recerca1" of page "recercat5" of this book
	push text of recordField "recerca2" of page "recercat5" of this book onto uz
	uz=text of recordField "recerca1" of page "recercat6" of this book
	push text of recordField "recerca2" of page "recercat6" of this book onto uz	
	
	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"

	un1=aa
	mgrafic= un1

		put first char of mgrafic into davant
		if davant is in ae1
		put ae into ab
		end if
		if davant is in fk1
		put fk into ab
		end if
		if davant is in lņ1
		put lņ into ab
		end if
		if davant is in op1
		put op into ab
		end if
		if davant is in rt1
		put rt into ab
		end if
		if davant is in uz1
		put uz into ab
		end if
	
	step i from 1 to textlineCount(ab)
	meu= textline i of ab
	if mgrafic is in meu
	put meu into text of recordField "solucio1" of this page
	search in RecordField "solucio1" for mgrafic as word
	if sysErrorNumber = 641
	continue
	else 
	put first word of meu into meu1
	end if
	end if
	end step
	if meu1 is not null
	insert graphic bitmap meu1 into text of RecordField "parag1" of this page
	forward
	end if
	end if

	clear meu
	clear meu1
	clear mgrafic
	clear text of recordField "solucio1" of this page

	sysCursor=1
	clear text of recordfield "texte" of page "frase"
	put aa after last word of text of recordfield "texte" of page "frase"

	forward
	end conditions

end keyDown
----------------------------------------------------------------------
Field id 8 ("titol1") of Page id 19 (p. 6)
----------------------------------------------------------------------
to handle enterfield	
	fontface of field "titol1" of page "mostra1"=sysfontFace
	put sysfontsize into suma
	suma1=suma+2
	fontSize of field "titol1" of page "mostra1"=suma1
	fontStyle of field "titol1" of page "mostra1"=underline
end	
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 87
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 87
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 87
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 87
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Page id 293 ("ajuda") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	show group botons of this background
	hide button "abans" of this background
	hide button "index" of this background
	show button "despres" of this background
	system vtipus
	if vtipus=noanima
	hide field "ocult1" of this page
	else
	show field "ocult1" of this page
	end if
end	
to handle leavePage
	show button "abans" of this background
	show button "index" of this background
end	

----------------------------------------------------------------------
Hotword id 29 of Page id 293 (p. 135)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuverbs"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Hotword id 28 of Page id 293 (p. 135)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajucategor"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Hotword id 27 of Page id 293 (p. 135)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajubilingue"
		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Hotword id 26 of Page id 293 (p. 135)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajufrases"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Hotword id 24 of Page id 293 (p. 135)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuimportar"

		show viewer "ajuda"
end buttonClick

----------------------------------------------------------------------
Hotword id 34 of Page id 293 (p. 135)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajugrafics"

		show viewer "ajuda"
end buttonClick

----------------------------------------------------------------------
Hotword id 39 of Page id 293 (p. 135)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuorienta"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Hotword id 40 of Page id 293 (p. 135)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajufuncio"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Field id 41 of Page id 293 (p. 135)
----------------------------------------------------------------------
-- This object has hyperlink properties
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
----------------------------------------------------------------------
Hotword id 36 of Page id 293 (p. 135)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajucontes"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 95
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 95
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 95
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 95
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 78
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 78
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 78
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 78
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 103
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 103
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 103
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 103
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Page id 320 ("ajugrafics") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	system vtipus
	if vtipus=noanima
	hide field "ocult1" of this page
	hide picture "ocult1" of this page
	else
	show field "ocult1" of this page
	show picture "ocult1" of this page
	end if
end
----------------------------------------------------------------------
Hotword id 17 of Page id 320 (p. 138)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuimportar"

		show viewer "ajuda"
end buttonClick

----------------------------------------------------------------------
Hotword id 23 of Page id 320 (p. 138)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuobject"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Hotword id 19 of Page id 320 (p. 138)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajufilmacio"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 105
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 105
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 105
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 105
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 81
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 81
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 81
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 81
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Page id 287 ("ajufrases") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	system vtipus
	if vtipus=noanima
	hide field "ocult1" of this page
	hide picture "ocult1" of this page
	hide field "ocult2" of this page
	hide picture "ocult2" of this page
	else
	show field "ocult1" of this page
	show picture "ocult1" of this page
	show field "ocult2" of this page
	show picture "ocult2" of this page
	end if
end
----------------------------------------------------------------------
Hotword id 19 of Page id 287 (p. 140)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajucontes"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Hotword id 13 of Page id 287 (p. 140)
----------------------------------------------------------------------
to handle buttonClick
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajucontes"

		show viewer "ajuda"
end buttonClick
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 82
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 82
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 82
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 82
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 83
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 83
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 83
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 83
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 84
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 84
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 84
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 84
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Page id 290 ("ajuverbs") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	system vtipus
	if vtipus=noanima
	hide button "despres" of this background
	end if
end	
to handle leavePage
	show button "despres" of this background
end	
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 93
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 93
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 93
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 93
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 101
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 101
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 101
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 101
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Button id 7 ("despres") of Background id 100
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to next page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 6 ("abans") of Background id 100
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		go to previous page
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Button id 5 ("Index") of Background id 100
----------------------------------------------------------------------
to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end buttonClick

----------------------------------------------------------------------
Group id 9 ("botons") of Background id 100
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end
----------------------------------------------------------------------
Page id 312 ("ajufilmacio") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	hide button "despres" of this background
end	
to handle leavePage
	show button "despres" of this background
end	
----------------------------------------------------------------------
Page id 229 ("histories") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	clear text of field "nou" of this page
end

to handle leavePage
	clear text of field "nou" of this page
end

----------------------------------------------------------------------
Button id 13 ("Aplicar") of Page id 229 (p. 149)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	vnou=text of field "nou" of this page
	new clip from "\signe2\contes\"&vnou&".avi"
	name of It=	vnou
	put crlf & vnou after last word of text of field "histories" of this page
	vnom=text of field "histories" of this page
	dropDownItems of combobox "llistat" of background "frase" = "                TRIA UN CONTE O UNA HISTŌRIA:"& crlf &vnom
	text of comboBox "llistat" of background "frase"= "                TRIA UN CONTE O UNA HISTŌRIA:"
	clear text of field "nou" of this page
	hide viewer "histories"
	syscursor = 1
end	


	
----------------------------------------------------------------------
Button id 11 ("Anulˇlar") of Page id 229 (p. 149)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	clear text of field "nou" of this page
	text of comboBox "llistat" of background "frase"= "                TRIA UN CONTE O UNA HISTŌRIA:"
	close viewer "histories" of this book
end	


	
----------------------------------------------------------------------
Button id 10 ("impoconte") of Page id 229 (p. 149)
----------------------------------------------------------------------
to handle buttonClick
	sysCursor=4
	linkDll "tbdlg.dll"
	STRING OpenFileDlg(STRING,STRING,STRING,STRING,int)
	end linkDll
	
	strCaption = "Importar un text"
	strFilterList = ""
	fitxers="\signe2\contes\"
	push "Tots els fitxers (*.*),*.*" onto strFilterList
	push "TXT(.Txt),*.txt" onto strFilterList
	get OpenFileDlg(strCaption,"",fitxers,strFilterList,1)
	if (it is not null)
	clear vconte
	nou=It
	step ctr from 18 to CharCount(nou)-4
	vcaract=char ctr of (nou)
	put vcaract after last char of vconte
	end step
	clear text of field "nou" of this page
	put vconte into text of field "nou" of page "histories"
	end if
	sysCursor=1
end	



--		& varrel & "aves"& crlf & varrel &
----------------------------------------------------------------------
Button id 7 of Background id 15
----------------------------------------------------------------------
to handle buttonClick
	system vnumvideo
	mmSeek clip vnumvideo to 0 from end
end
----------------------------------------------------------------------
Button id 6 of Background id 15
----------------------------------------------------------------------
to handle doStep
	system vnumvideo
	mmStep clip vnumvideo by 50 wait

end


to handle buttonClick
	send doStep
end

to handle buttonStillDown
	send doStep
end
----------------------------------------------------------------------
Button id 5 of Background id 15
----------------------------------------------------------------------
to handle doStep
	system vnumvideo
	mmStep clip vnumvideo back by 1 wait

end


to handle buttonClick
	send doStep
end

to handle buttonStillDown
	send doStep
end
----------------------------------------------------------------------
Button id 4 of Background id 15
----------------------------------------------------------------------
to handle buttonClick
	system vnumvideo
	mmSeek clip vnumvideo to 0

end
----------------------------------------------------------------------
Button id 3 of Background id 15
----------------------------------------------------------------------
to handle buttonClick
	system vnumvideo
	mmPause clip vnumvideo
end

----------------------------------------------------------------------
Button id 2 of Background id 15
----------------------------------------------------------------------
to handle buttonClick
	system vnumvideo
	mmPlay clip vnumvideo in stage videos1 of this background
end
----------------------------------------------------------------------
Group id 8 ("mmCOntrols") of Background id 15
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
----------------------------------------------------------------------
Page id 191 ("videos1") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	system vnumvideo
	mmplay clip signe2 in stage "videos1" of this background
	mmPlay clip vnumvideo in stage "videos1" of this background hold
end	

to handle leavePage
	system vnumvideo
	mmRewind clip vnumvideo
	
end	

----------------------------------------------------------------------
RecordField id 0 ("llista") of Background id 45
----------------------------------------------------------------------
notifyBefore enterPage
	system ARRAY STRING itemArray[]
	
	fill itemArray with my text in [textline] order
	set my selectedTextlines to 1
	set my scroll to 0
end enterPage

to handle buttonUp
	set text of recordfield "text" to selectedText
end buttonUp


to handle sortSelf
	local ARRAY dataArray[]
	local STRING sortedText
	sysCursor = 4
	-- put the textlines into an array
	fill dataArray with my text in [textline] order
	-- sort the array
	send quickSort dataArray
	-- convert the array back into textlines
	step i from 1 to dimensions(dataArray)
		put dataArray[i] & CRLF after sortedText
	end step
	-- get rid of trailing crlf's
	clear last char of sortedText
	clear last char of sortedText
	-- update the text
	set my text to sortedText
	sysCursor = default
end sortSelf

-- The next three handlers make up a Standard recursive QuickSort.
-- Keep in mind that arrays are passed by reference, not by value.
to handle quickSort fArray[] by reference
	system s_noSwap
	set s_noSwap to 0
    send quickSrt fArray, 1, dimensions ( fArray )
end quickSort

to handle quickSrt fArray[] by reference, lo, hi
    system  s_noSwap
    if hi > lo 
		send swap  fArray, lo, ((lo+hi) div 2)
		set lst to lo
		step i from (lo+1) to hi
        	if fArray[i] < fArray[lo] as text
        		increment lst
        		send swap fArray, lst, i
        	else
        		increment s_noswap
        	end if
        end step
        send swap fArray,lo,lst 
   		send quicksrt fArray, lo, lst-1
    	send quicksrt fArray, lst+1,hi
   	end if
end quickSrt

to handle swap fArray[] by reference, x, y
	local temp
	set temp to fArray[x]
	set fArray[x] to fArray[y]
	set fArray[y] to temp
end swap


-- use if inserting a single line. Will maintain sorted order
to handle insertLine newLine
	set my text to insertLineAux(my text,newLine)
end insertLine

-- inserts newLine into txt, maintaining sorted order.
-- works only if txt is already sorted.
to get insertLineAux txt,newLine
	if txt is null
		return newLine
	end if
	set start to 1  -- first textline
	set tlc to textlinecount(txt)
	set ending to tlc -- last textline
	local insertSpot
	while start <= ending 
		set midPoint to (start+ending) div 2 
		set middleLine to textline midPoint of txt
		conditions
		when newLine < middleLine as text
			-- start looking at values less than current midPoint
			set ending to midPoint-1
			set insertSpot to midPoint
		when newLine > middleLine as text
			-- start looking at values greater than current midPoint
			set start to midPoint+1
			set insertSpot to midPoint+1
		else
			-- the item already exists
			set insertSpot to midPoint
			break while
		end conditions
	end while
	if insertSpot > tlc
		put newLine before textline insertSpot of txt
	else
		put newLine&crlf before textline insertSpot of txt
	end if
	return txt
end insertLineAux


----------------------------------------------------------------------
Page id 251 ("categories") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	hide button "boto1" of this page
	hide button "boto2" of this page
	restore menuBar
	disable menuItem "Llegir" at reader	
	disable menu "Lletra" at reader
	disable menu "Pāgina" at reader
	disable menu "Ediciķ" at reader
	disable menu "Categories" at reader
	disable menuItem "Imprimir el text" at reader
	disable menuItem "Imprimir la pāgina" at reader
	disable menuItem "Configurar categories" at reader
	disable menuItem "Importar text" at reader
--	disable menuItem "Editor de text bilingüe" at reader
	disable menuItem "Importar dibuixos d'objectes" at reader
	disable menuItem "Importar filmacions de signes" at reader
	clear text of field "item" of this page
	clear text of field "sel" of this page
	clear text of field "formes" of this page
	put text of recordField "llista" of page "categories" into vbenji
	put vbenji into text of field "index" of page "categories"
	forward
end enterPage	
----------------------------------------------------------------------
Button id 215 ("boto2") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle buttonClick
	sysCursor=4
	if text of field "item" of this page is null
	request "No heu seleccionat cap paraula"
	break
	else
	if text of field "sel" of this page is null
	request "No heu seleccionat cap categoria"
	break
	else
	vnovap=text of field "item" of this page
	
	clear contenidor
	vmot=text of field "item" of this page
	put vmot&&space into contenidor	
	
	request "La paraula"&& vnovap && "es classicara a les categories seleccionades" with "SEGUIR" or "ANULˇLAR"
			conditions
			when It is "ANULˇLAR"
			clear text of field "sel" of this page
			syscursor = 1
			break
			when It is "SEGUIR"
			
	vpassat=text of field "formes" of this page
	step ctr from 1 to wordCount(vpassat)
	varrel= word ctr of vpassat
	put space&&varrel after last word of contenidor
	end step
	
	search in recordField "llista" of this page for vnovap as word
	send clear
	send clear
	end conditions
	end if
	end if
	ae1= "a b c į d e"
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	ot1= "o p q r s t "
	uz1= "u v w x y z"	
	
	put first char of vmot into davant
	
	if davant is in ae1
	put charCount(text of recordfield "recerca1" of page "recercat1" of this book) into dir
	if dir < 31700
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat1" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat1" of this book
	end if
	end if	
	if davant is in fk1
	put charCount(text of recordfield "recerca1" of page "recercat2" of this book) into dir
	if dir < 31700
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat2" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat2" of this book
	end if
	end if
	if davant is in lņ1
	put charCount(text of recordfield "recerca1" of page "recercat3" of this book) into dir
	if dir < 31700
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat3" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat3" of this book
	end if
	end if
	if davant is in ot1
	put charCount(text of recordfield "recerca1" of page "recercat4" of this book) into dir
	if dir < 31700
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat4" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat4" of this book
	end if
	end if
	if davant is in uz1
	put charCount(text of recordfield "recerca1" of page "recercat5" of this book) into dir
	if dir < 31700
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat5" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat5" of this book
	end if
	end if
	put text of recordField "llista" of page "categories" into vbenji
	put vbenji into text of field "index" of page "categories"
	clear text of field "item" of this page
	clear text of field "sel" of this page
	clear text of field "formes" of this page
	focus=field "item" of this page
	sysCursor=1
end
----------------------------------------------------------------------
Button id 214 ("Aplicar") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	


to handle buttonClick
	sysCursor=4
	if text of field "item" of this page is null
	request "No heu seleccionat cap paraula"
	break
	else
	if text of field "sel" of this page is null
	request "No heu seleccionat cap categoria"
	break
	else
	vnovap=text of field "item" of this page
	
	clear contenidor
	vmot=text of field "item" of this page
	put vmot&&space into contenidor	
	
	request "La paraula"&& vnovap && "es classicara a les categories seleccionades" with "SEGUIR" or "ANULˇLAR"
			conditions
			when It is "ANULˇLAR"
			clear text of field "sel" of this page
			syscursor = 1
			break
			when It is "SEGUIR"
			
	vct=text of field "sel" of this page
	step ctr from 1 to wordCount(vct)
	vcate= word ctr of vct
	put space & vnovap after last word of text of recordField vcate of page "categories1"
	end step
	
	vpassat=text of field "formes" of this page
	step ctr from 1 to wordCount(vpassat)
	varrel= word ctr of vpassat
	put space&&varrel after last word of contenidor
	end step
	
	search in recordField "llista" of this page for vnovap as word
	send clear
	send clear
	end conditions
	end if
	end if

	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"
	
	put first char of vmot into davant
	
	if davant is in ae1
	put charCount(text of recordfield "recerca1" of page "recercat1" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat1" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat1" of this book
	end if
	end if	
	if davant is in fk1
	put charCount(text of recordfield "recerca1" of page "recercat2" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat2" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat2" of this book
	end if
	end if
	if davant is in lņ1
	put charCount(text of recordfield "recerca1" of page "recercat3" of this book) into dir
	if dir < 31500
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat3" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat3" of this book
	end if
	end if
	if davant is in op1
	put charCount(text of recordfield "recerca1" of page "recercat4" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat4" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat4" of this book
	end if
	end if
	if davant is in rt1
	put charCount(text of recordfield "recerca1" of page "recercat5" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat5" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat5" of this book
	end if
	end if
	if davant is in uz1
	put charCount(text of recordfield "recerca1" of page "recercat6" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat6" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat6" of this book
	end if
	end if	
	put text of recordField "llista" of page "categories" into vbenji
	put vbenji into text of field "index" of page "categories"
	clear text of field "item" of this page
	clear text of field "sel" of this page
	clear text of field "formes" of this page
	focus=field "item" of this page
	sysCursor=1
end
----------------------------------------------------------------------
Button id 212 ("Acabar") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		request "Voleu salvar els canvis per a properes sessions?" with "SI" or "NO" or "ANULˇLAR"
			conditions
			when It is "SI"
			syscursor = 4
			clear text of recordField "titol" of page "FRASE"
			clear text of recordField "texte" of page "FRASE"
			save changes to this book
			send exit
			when It is "NO"
			send exit
			when It is "ANULˇLAR"
			break
			end conditions
end	


	
----------------------------------------------------------------------
Field id 211 ("item") of Page id 251 (p. 152)
----------------------------------------------------------------------



to handle buttonClick
	sysCursor=4

	Request "Per seleccionar paraules heu de clicar sobre les de la llista NOVES PARAULES"

	sysCursor=1
end	






to handle keyChar
	system ARRAY STRING itemArray[]
	
	local WORD itemNumber, stringLength
	local STRING string
	
	--vérifie que la matrice est initialisée
	if itemArray[1] = null
		--sinon, initialisez-la
		sendnotifyBefore enterPage to field "index"
	end if
	
	--fait suivre le caractčre tapé pour que le nouveau caractčre soit placé dans le champ
	forward
	
	--verrouille l'écran pendant la recherche de la corresondance la plus proche
	sysLockScreen = TRUE
	
	--met le texte en antémémoire pour ne pas avoir ā rechercher la propriété si souvent.
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	string = my text
	
	--stocke la longueur de la chaîne courante
	stringLength = charCount(my text)
	
	--stocke le nombre d'éléments du champ dans lequel la recherche s'effectue
	numberItems = dimensions(itemArray)
	
	--s'il y a du texte dans le champ, effectue une recherche pour trouver la correspondance 
	--la plus proche
	if stringLength > 0
		-- s'il y a un seul caractčre dans le champ, effectue une recherche binaire pour aller
		-- au début du groupe alphabétique de cette lettre
		if stringLength = 1

			get binarySearch(string)

			--sélectionne la ligne de texte trouvée et fait défiler le champ pour l'atteindre
			set selectedTextlines of field "index" to it
			set scroll of field "index" to it - 1

		--il y a plusieurs caractčres dans ce champ, donc commence la recherche séquentielle
		-- pour trouver la correspondance la plus proche
		else

			--commence ā la ligne actuellement sélectionnée qui est l'ancienne 					--correspondance la plus proche
			itemNumber = selectedTextlines of field "index"

			conditions
				
			--lorsque les premiers n caractčres de l'élément de la matrice sont inférieurs ā la 			--chaîne courante, il faut effectuer une recherche séquentielle vers le bas dans
			-- la matrice jusqu'ā ce que l'élément suivant soit supérieur ou égal ā la chaîne
			-- courante ou jusqu'ā atteindre la fin de la matrice
			when chars 1 to stringLength of itemArray[itemNumber] < string as text
				while chars 1 to stringLength of itemArray[itemNumber + 1] < string as text and \
				      itemNumber <= numberItems
					increment itemNumber
				end
				
				-- si l'on arręte la recherche parce que les chaînes sont égales, le
				-- nombre d'éléments devrait ętre incrémenté pour que la ligne égale,
				-- et non pas celle au-dessus, soit mise en surbrillance.
				if chars 1 to stringLength of itemArray[itemNumber + 1] = string as text
					increment itemNumber
				end
				
			-- lorsque les premiers n caractčres de l'élément de la matrice sont supérieurs 				-- ou égaux ā la chaîne courante, il faut effectuer une recherche séquentielle
			-- vers le haut dans la matrice jusqu'ā ce que l'élément suivant soit le premier
			-- dans la matrice ou soit l'élément < de matrice.
			when chars 1 to stringLength of itemArray[itemNumber] >= string as text
				while itemNumber > 1 and \
				  chars 1 to stringLength of itemArray[itemNumber - 1] >= string as text    
					decrement itemNumber
				end				
			end conditions
			
			--sélectionne la ligne de texte avec la correspondance la plus proche
			-- et la fait défiler
			set selectedTextlines of field "index" to itemNumber
			set scroll of field "index" to itemNumber - 1
		end if
	else
		--s'il n'y a pas de texte dans le champ, sélectionne la premičre ligne de texte
		--et la fait défiler vers le haut du champ
		set selectedTextlines of field "index" to 1
		set scroll of field "index" to 0
	end if
	sysLockScreen = FALSE
end keyChar

to get binarySearch string
	system ARRAY STRING itemArray[]
	
	--initialise les limites supérieures et inférieures et le point de départ de la recherche
	upper = dimensions (itemArray)
	lower = 1
	currentPosition = (lower + upper)  DIV 2
	
	found = FALSE
	
	-- diminue l'ampleur de la recherche jusqu'ā la découverte d'une correspondance ou jusqu'ā ce
	-- qu'il n'y a plus d'éléments ā rechercher
	while not found and (upper >= lower)
		conditions
		-- lorsque la chaîne est inférieure ā l'élément de la matrice, les éléments situés 				-- au-dessus de l'élément de la matrice sont éliminés et la recherche s'effectue				-- sur la moitié inférieure
		when string < char 1 of itemArray[currentPosition] as text
			upper = currentPosition - 1
			currentPosition = (lower + upper) DIV 2
			
		-- lorsque la chaîne est supérieure ā l'élément de la matrice, les éléments situés 
		--au-dessous de l'élément de la matrice sont éliminés et la recherche s'effectue
		-- sur la moitié supérieure
		when string > char 1 of itemArray[currentPosition] as text
			lower = currentPosition + 1
			currentPosition = (lower + upper) DIV 2
		else
		--soit nous avons une correspondance, soit la chaîne ne se trouve pas dans la matrice
			found = TRUE
		end conditions
	end while

	--si la recherche est arrętée parce que la correspondance exacte n'est pas trouvée, il faut
	--vérifier s'il est nécessaire d'aller d'un élément plus loin car l'élément aprčs lequel
	--la chaîne devrait aller est sélectionné dans la chaîne sans correspondance.
	if not found and string > char 1 of itemArray[currentPosition] as text
		increment currentPosition
	end if

	--nous devons nous assurer de sélectionner le premier élément qui correspond ā la chaîne,
	--ainsi, lorsqu'une correspondance est trouvée, il faut se déplacer vers le haut de la matrice
	--pour trouver l'élément.
	while currentPosition > 1 and string = char 1 of itemArray[currentPosition - 1] as text
		decrement currentPosition
	end while
	
	return currentPosition
end binarySearch
----------------------------------------------------------------------
Button id 208 ("boto1") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle buttonClick
	ask "quina categoria?"
	if It is not null
	put It into categor
	clear text of recordfield "llista" of page "categories"
	vcompara=text of recordField categor of page "categories1"
		step ctr from 1 to WordCount (vcompara)
			exp= word ctr of vcompara
			if exp is not in vTxte
			put crlf & exp after last word of text of recordfield "llista" of page "categories"
			end if
		end step
	put text of recordField "llista" of page "categories" into vbenji
	put vbenji into text of field "index" of page "categories"
	end if
	
		
end 		
----------------------------------------------------------------------
Button id 201 ("Anulˇlar") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	sysCursor=4
	clear text of field "formes" of this page
	clear text of field "sel" of this page
	sysCursor=1
end 


	
----------------------------------------------------------------------
Button id 199 ("gestio") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	syscursor = 4
	clear text of recordField "titol" of page "frase"
	clear text of recordField "texte" of page "frase"
	go to page "gestio"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 198 ("ajuda") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end
----------------------------------------------------------------------
Button id 196 ("frases") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	clear text of recordField "titol" of page "frase"
	clear text of recordField "texte" of page "frase"
	go to page "frase"
	syscursor = 1
end	
----------------------------------------------------------------------
Group id 187 ("CBT Radio Buttons") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	sysCursor=4
	if text of field "item" of this page is null
	request "No heu seleccionat cap paraula de la llista"
	break
	else
	vmot=text of field "item" of this page
	clear text of field "formes" of this page
	put vmot &"a" & crlf & vmot & "s"& crlf & vmot & "es" into text of field "formes" of this page
	send (answerMessage of target) to target
	end if
	sysCursor=1
end buttonClick


to set editWidget to val
	send customEdit to item 1 of my objects
end editWidget

to handle answer1
	vcate=caption of target
	vmot=text of field "item" of this page
	if vcate is not "Verbs"
	clear text of field "formes" of this page
	put vmot &"a" & crlf & vmot & "s"& crlf & vmot & "es" into text of field "formes" of this page
	put CRLF & vcate after last word of text of field "sel" of this page
	else
	request "A continuaciķ validareu les formes del gerundi i infinitiu d'aquest verb, perō un cop aplicats els canvis, cal que aneu a CONJUGAR VERBS per tal de validar també les formes conjugades"
	clear text of field "formes" of this page
	put vmot &"t" & crlf & vmot & "ts"& crlf & vmot & "nt" & crlf & vmot & "da" & crlf & vmot & "des" into text of field "formes" of this page	
	put CRLF & vcate after last word of text of field "sel" of this page
	end if
end answer1

to handle answer2
	vcate=caption of target
	vmot=text of field "item" of this page
	if vcate is not "Verbs"
	clear text of field "formes" of this page
	put vmot &"a" & crlf & vmot & "s"& crlf & vmot & "es" into text of field "formes" of this page
	put CRLF & vcate after last word of text of field "sel" of this page
	else
	request "A continuaciķ validareu les formes del gerundi i infinitiu d'aquest verb, perō un cop aplicats els canvis, cal que aneu a CONJUGAR VERBS per tal de validar també les formes conjugades"	
	clear text of field "formes" of this page
	put vmot &"t" & crlf & vmot & "ts"& crlf & vmot & "nt" & crlf & vmot & "da" & crlf & vmot & "des" into text of field "formes" of this page	
	put CRLF & vcate after last word of text of field "sel" of this page
	end if
end answer2

to handle answer3
	vcate=caption of target
	vmot=text of field "item" of this page	
	if vcate is not "Verbs"
	clear text of field "formes" of this page
	put vmot &"a" & crlf & vmot & "s"& crlf & vmot & "es" into text of field "formes" of this page
	put CRLF & vcate after last word of text of field "sel" of this page
	else
	request "A continuaciķ validareu les formes del gerundi i infinitiu d'aquest verb, perō un cop aplicats els canvis, cal que aneu a CONJUGAR VERBS per tal de validar també les formes conjugades"	
	clear text of field "formes" of this page
	put vmot &"t" & crlf & vmot & "ts"& crlf & vmot & "nt" & crlf & vmot & "da" & crlf & vmot & "des" into text of field "formes" of this page	
	put CRLF & vcate after last word of text of field "sel" of this page
	end if
end answer3

to handle answer4
	vcate=caption of target
	vmot=text of field "item" of this page	
	if vcate is not "Verbs"
	clear text of field "formes" of this page
	put vmot &"a" & crlf & vmot & "s"& crlf & vmot & "es" into text of field "formes" of this page
	put CRLF & vcate after last word of text of field "sel" of this page
	else
	request "A continuaciķ validareu les formes del gerundi i infinitiu d'aquest verb, perō un cop aplicats els canvis, cal que aneu a CONJUGAR VERBS per tal de validar també les formes conjugades"	
	clear text of field "formes" of this page
	put vmot &"t" & crlf & vmot & "ts"& crlf & vmot & "nt" & crlf & vmot & "da" & crlf & vmot & "des" into text of field "formes" of this page	
	put CRLF & vcate after last word of text of field "sel" of this page
	end if
end answer4


----------------------------------------------------------------------
Rectangle id 129 ("widgetParent") of Page id 251 (p. 152)
----------------------------------------------------------------------
--	Tim Pearson, Asymetrix	1/94

to handle customEdit
	system			s_answerMessages
	local			init, box, answers
	local	LONG	i

	linkDLL sysToolBookDirectory & "tbdlg.dll"
		STRING	DialogCallback		(WORD,STRING,STRING,STRING)
		STRING	SetValue			(STRING,STRING,STRING)
		STRING 	GetValue			(STRING,STRING)
		INT		AddListBoxItem		(WORD,STRING,STRING,INT,INT)
		INT		DeletenListBoxItem	(WORD,STRING,INT)
		INT		EnableControl		(WORD,STRING,INT)
		STRING	GetControlText		(WORD,STRING)
		STRING	GetDialogFocus		(WORD)
		STRING	GetListBoxItems		(WORD,STRING)
		STRING	GetListBoxSelection	(WORD,STRING)
		STRING	GetnListBoxSelection(WORD,STRING)
		INT		SetControlText		(WORD,STRING,STRING)
		INT		SetDialogFocus		(WORD,STRING)
		INT		SetListBoxItems		(WORD,STRING,STRING)
		INT		SetnListBoxSelection(WORD,STRING,STRING)
		INT 	endTBKDialog		(WORD,INT)
	end linkDLL
	
	init = ",G3597,Answers:,S3603,Message to Send When Chosen:LISTBOX answers,L3596,BUTtoN add,B3600,NODISMISSBUTtoN delete,B3601,NODISMISSBUTtoN edit,B3602,NODISMISSEDIT message,E3604,BUTtoN ok,B1,TRUEBUTtoN cancel,B3606,FALSE"
	
box = "524480,9,25,25,228,104,,,Edit Multiple Choice,8,MS Sans Serif,,2,4,171,80,3597,1342177287,128,Answers:,0,,5,59,125,7,3603,1342177280,130,Text,0,answers,5,17,124,39,3596,1352728577,131,,0,add,133,17,37,12,3600,1342242816,128,&Add,0,delete,133,31,37,12,3601,1342242816,128,&Delete,0,edit,133,45,37,12,3602,1342242816,128,&Edit...,0,message,5,69,124,11,3604,1350631552,129,,0,ok,178,7,44,12,1,1342242817,128,OK,0,cancel,178,22,44,12,3606,1342242816,128,Cancel,0"

	step i from 2 to itemCount(objects of my parent)
		textline i - 1 of answers = caption of item i of objects of my parent
		item i - 1 of s_answerMessages = answerMessage of item i of objects of my parent
	end step
	set init to SetValue(init,"listBox answers",answers)
	get DialogCallback(windowhandle of this window,box,init,self)
	clear sysError
	unlinkDLL sysToolBookDirectory & "tbdlg.dll"
end customEdit

to get TBKDialogInit	hDlg,ctrlId,hWnd,msg,ctrlName
	local			answers, cnt

	get SetnListBoxSelection(hDlg,"listBox answers",1)
	get SetControlText(hDlg,"edit message",GetListBoxSelection(hDlg,"listBox answers"))
	answers = GetListBoxItems(hDlg,"listbox answers")
	cnt = textlineCount(answers)
	if cnt <= 1
		get EnableControl(hDlg,"button delete",0)
	else
		get EnableControl(hDlg,"button delete",1)
	end if
	return 1
end TBKDialogInit

to get TBKDialogCommand	hDlg,ctrlId,hWnd,msg,ctrlName
	system			s_answerMessages
	local	OBJECT	thisLayer
	local	LONG	i
	local			sel, foc, answers, newAnswer, cnt, answerCount, oldScript

	conditions
	when ctrlName = "LISTBOX answers"
		conditions
		when msg = 1
		when msg = 4
			get GetnListBoxSelection(hDlg,"listBox answers")
			get SetControlText(hDlg,"edit message",item it of s_answerMessages)
		when msg = 2
			sel = GetnListBoxSelection(hDlg,"listBox answers")
			foc	= GetDialogFocus(hDlg)
			clear sysError
			ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
			if sysError <> "Cancel"
				newAnswer = it
				answers = GetListBoxItems(hDlg,"listbox answers")
				textline sel of answers = newAnswer
				get SetListBoxItems(hDlg,"listBox answers",answers)
				get SetnListBoxSelection(hDlg,"listBox answers",sel)
				get SetDialogFocus(hDlg,foc)
			end if
		end conditions
	when ctrlName = "Button add"
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers) + 1
		get AddListBoxItem(hDlg,"listBox answers","Answer &" & cnt,-1,0)
		item cnt of s_answerMessages = "answer" & cnt
		get SetnListBoxSelection(hDlg,"listBox answers",cnt)
		get SetControlText(hDlg,"edit message","answer" & cnt)
		get EnableControl(hDlg,"button delete",1)
	when ctrlName = "Button delete"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers)
		if sel <> NULL and cnt > 1
			get DeletenListBoxItem(hDlg,"listBox answers",sel)
			clear item sel of s_answerMessages
			if sel = cnt
				decrement sel
			end if
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetControlText(hDlg,"edit message",item sel of s_answerMessages)
			if cnt - 1 <= 1
				get EnableControl(hDlg,"button delete",0)
			else
				get EnableControl(hDlg,"button delete",1)
			end if
		end if
	when ctrlName = "Button edit"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		foc	= GetDialogFocus(hDlg)
		clear sysError
		ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
		if sysError <> "Cancel"
			newAnswer = it
			answers = GetListBoxItems(hDlg,"listbox answers")
			textline sel of answers = newAnswer
			get SetListBoxItems(hDlg,"listBox answers",answers)
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetDialogFocus(hDlg,foc)
		end if
	when ctrlName = "EDIT message"
		if msg = 512
			get GetnListBoxSelection(hDlg,"listBox answers")
			item it of s_answerMessages = GetControlText(hDlg,"edit message")
		end if
	when ctrlName = "Button ok"
		lockScreen of this window = TRUE
		cnt = itemCount(objects of my parent) - 1
		answers = GetListBoxItems(hDlg,"listbox answers")
		answerCount = textlineCount(answers)
		conditions
		when answerCount < cnt
			while itemCount(objects of my parent) - 1 > answerCount
				select last item of objects of my parent
				send clear
			end while
		when answerCount > cnt
			step i from 2 to cnt + 1
				name of item i of objects of my parent = "newAnswer" & (i - 1)
			end step
			step i from cnt + 1 to answerCount
				draw button from items 1 to 2 of bounds of item 2 of objects of my parent to items 3 to 4 of bounds of item 2 of objects of my parent
				borderStyle of selection = borderStyle of item 2 of objects of my parent
				name of selection = "newAnswer" & i
				caption of selection = "Answer &" & i
			end step
			cnt = answerCount
			thisLayer = objLayer(self)
			select my parent
			oldScript = script of selection
			send ungroup
			show self
			select self
			step i from 1 to cnt
				get "button" && QUOTE & "newAnswer" & i & QUOTE && "of" && thisLayer
				extend select it
			end step
			send group
			if oldScript = NULL
				script of selection = \
				  "to handle buttonClick" & CRLF & \
				  TAB & "send (answerMessage of target) to target" & CRLF & \
				  "end" & CRLF & CRLF & \
				  "to set editWidget" & CRLF & \
				  TAB & "send customEdit to item 1 of my objects" & CRLF & \
				  "end"
			else
				script of selection = oldScript
			end if
			autoRadioButtons of selection = TRUE
			tbk_wid_name of selection = "Multiple Choice"
			tbk_wid_props of selection = "editWidget"
			tbk_wid_values of selection = "custom,editWidget"
			hide self 
		end conditions
		cnt = itemCount(objects of my parent)
		step i from 2 to cnt
			name of item i of objects of my parent = i - 1
			highlight of item i of objects of my parent = FALSE
			caption of item i of objects of my parent = textline i - 1 of answers
			answerMessage of item i of objects of my parent = item i - 1 of s_answerMessages
		end step
		clear s_answerMessages
		step i from 3 to cnt
			position of item i of objects of my parent = item 1 of bounds of item i - 1 of objects of my parent,item 4 of bounds of item i - 1 of objects of my parent
			size of item i of objects of my parent = size of item 2 of objects of my parent
		end step
		my bounds = bounds of item 2 of objects of my parent	
		return 1
		lockScreen of this window = FALSE
	when ctrlName = "Button cancel"
		get endTBKDialog(hDlg,0) -- 0 = annuler
 	end conditions
	return 0
end TBKDialogCommand

to get objLayer	obj
	while object of obj is not in "page,background"
		obj = parent of obj
	end while
	return obj
end objLayer

notifyBefore customEdit obj
	if (obj is in objects of my parent or obj = my parent) and (sysLevel = "reader")
		send customEdit
		break to system
	end if
end customEdit

notifyBefore reader
	hide self
	my bounds = bounds of item 2 of objects of my parent
end reader

notifyBefore enterPage
	checked of my parent = FALSE
end enterPage

notifyBefore author
	checked of my parent = FALSE
end author
----------------------------------------------------------------------
Rectangle id 122 ("widgetParent") of Page id 251 (p. 152)
----------------------------------------------------------------------
--	Tim Pearson, Asymetrix	1/94

to handle customEdit
	system			s_answerMessages
	local			init, box, answers
	local	LONG	i

	linkDLL sysToolBookDirectory & "tbdlg.dll"
		STRING	DialogCallback		(WORD,STRING,STRING,STRING)
		STRING	SetValue			(STRING,STRING,STRING)
		STRING 	GetValue			(STRING,STRING)
		INT		AddListBoxItem		(WORD,STRING,STRING,INT,INT)
		INT		DeletenListBoxItem	(WORD,STRING,INT)
		INT		EnableControl		(WORD,STRING,INT)
		STRING	GetControlText		(WORD,STRING)
		STRING	GetDialogFocus		(WORD)
		STRING	GetListBoxItems		(WORD,STRING)
		STRING	GetListBoxSelection	(WORD,STRING)
		STRING	GetnListBoxSelection(WORD,STRING)
		INT		SetControlText		(WORD,STRING,STRING)
		INT		SetDialogFocus		(WORD,STRING)
		INT		SetListBoxItems		(WORD,STRING,STRING)
		INT		SetnListBoxSelection(WORD,STRING,STRING)
		INT 	endTBKDialog		(WORD,INT)
	end linkDLL
	
	init = ",G3597,Answers:,S3603,Message to Send When Chosen:LISTBOX answers,L3596,BUTtoN add,B3600,NODISMISSBUTtoN delete,B3601,NODISMISSBUTtoN edit,B3602,NODISMISSEDIT message,E3604,BUTtoN ok,B1,TRUEBUTtoN cancel,B3606,FALSE"
	
box = "524480,9,25,25,228,104,,,Edit Multiple Choice,8,MS Sans Serif,,2,4,171,80,3597,1342177287,128,Answers:,0,,5,59,125,7,3603,1342177280,130,Text,0,answers,5,17,124,39,3596,1352728577,131,,0,add,133,17,37,12,3600,1342242816,128,&Add,0,delete,133,31,37,12,3601,1342242816,128,&Delete,0,edit,133,45,37,12,3602,1342242816,128,&Edit...,0,message,5,69,124,11,3604,1350631552,129,,0,ok,178,7,44,12,1,1342242817,128,OK,0,cancel,178,22,44,12,3606,1342242816,128,Cancel,0"

	step i from 2 to itemCount(objects of my parent)
		textline i - 1 of answers = caption of item i of objects of my parent
		item i - 1 of s_answerMessages = answerMessage of item i of objects of my parent
	end step
	set init to SetValue(init,"listBox answers",answers)
	get DialogCallback(windowhandle of this window,box,init,self)
	clear sysError
	unlinkDLL sysToolBookDirectory & "tbdlg.dll"
end customEdit

to get TBKDialogInit	hDlg,ctrlId,hWnd,msg,ctrlName
	local			answers, cnt

	get SetnListBoxSelection(hDlg,"listBox answers",1)
	get SetControlText(hDlg,"edit message",GetListBoxSelection(hDlg,"listBox answers"))
	answers = GetListBoxItems(hDlg,"listbox answers")
	cnt = textlineCount(answers)
	if cnt <= 1
		get EnableControl(hDlg,"button delete",0)
	else
		get EnableControl(hDlg,"button delete",1)
	end if
	return 1
end TBKDialogInit

to get TBKDialogCommand	hDlg,ctrlId,hWnd,msg,ctrlName
	system			s_answerMessages
	local	OBJECT	thisLayer
	local	LONG	i
	local			sel, foc, answers, newAnswer, cnt, answerCount, oldScript

	conditions
	when ctrlName = "LISTBOX answers"
		conditions
		when msg = 1
		when msg = 4
			get GetnListBoxSelection(hDlg,"listBox answers")
			get SetControlText(hDlg,"edit message",item it of s_answerMessages)
		when msg = 2
			sel = GetnListBoxSelection(hDlg,"listBox answers")
			foc	= GetDialogFocus(hDlg)
			clear sysError
			ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
			if sysError <> "Cancel"
				newAnswer = it
				answers = GetListBoxItems(hDlg,"listbox answers")
				textline sel of answers = newAnswer
				get SetListBoxItems(hDlg,"listBox answers",answers)
				get SetnListBoxSelection(hDlg,"listBox answers",sel)
				get SetDialogFocus(hDlg,foc)
			end if
		end conditions
	when ctrlName = "Button add"
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers) + 1
		get AddListBoxItem(hDlg,"listBox answers","Answer &" & cnt,-1,0)
		item cnt of s_answerMessages = "answer" & cnt
		get SetnListBoxSelection(hDlg,"listBox answers",cnt)
		get SetControlText(hDlg,"edit message","answer" & cnt)
		get EnableControl(hDlg,"button delete",1)
	when ctrlName = "Button delete"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers)
		if sel <> NULL and cnt > 1
			get DeletenListBoxItem(hDlg,"listBox answers",sel)
			clear item sel of s_answerMessages
			if sel = cnt
				decrement sel
			end if
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetControlText(hDlg,"edit message",item sel of s_answerMessages)
			if cnt - 1 <= 1
				get EnableControl(hDlg,"button delete",0)
			else
				get EnableControl(hDlg,"button delete",1)
			end if
		end if
	when ctrlName = "Button edit"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		foc	= GetDialogFocus(hDlg)
		clear sysError
		ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
		if sysError <> "Cancel"
			newAnswer = it
			answers = GetListBoxItems(hDlg,"listbox answers")
			textline sel of answers = newAnswer
			get SetListBoxItems(hDlg,"listBox answers",answers)
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetDialogFocus(hDlg,foc)
		end if
	when ctrlName = "EDIT message"
		if msg = 512
			get GetnListBoxSelection(hDlg,"listBox answers")
			item it of s_answerMessages = GetControlText(hDlg,"edit message")
		end if
	when ctrlName = "Button ok"
		lockScreen of this window = TRUE
		cnt = itemCount(objects of my parent) - 1
		answers = GetListBoxItems(hDlg,"listbox answers")
		answerCount = textlineCount(answers)
		conditions
		when answerCount < cnt
			while itemCount(objects of my parent) - 1 > answerCount
				select last item of objects of my parent
				send clear
			end while
		when answerCount > cnt
			step i from 2 to cnt + 1
				name of item i of objects of my parent = "newAnswer" & (i - 1)
			end step
			step i from cnt + 1 to answerCount
				draw button from items 1 to 2 of bounds of item 2 of objects of my parent to items 3 to 4 of bounds of item 2 of objects of my parent
				borderStyle of selection = borderStyle of item 2 of objects of my parent
				name of selection = "newAnswer" & i
				caption of selection = "Answer &" & i
			end step
			cnt = answerCount
			thisLayer = objLayer(self)
			select my parent
			oldScript = script of selection
			send ungroup
			show self
			select self
			step i from 1 to cnt
				get "button" && QUOTE & "newAnswer" & i & QUOTE && "of" && thisLayer
				extend select it
			end step
			send group
			if oldScript = NULL
				script of selection = \
				  "to handle buttonClick" & CRLF & \
				  TAB & "send (answerMessage of target) to target" & CRLF & \
				  "end" & CRLF & CRLF & \
				  "to set editWidget" & CRLF & \
				  TAB & "send customEdit to item 1 of my objects" & CRLF & \
				  "end"
			else
				script of selection = oldScript
			end if
			autoRadioButtons of selection = TRUE
			tbk_wid_name of selection = "Multiple Choice"
			tbk_wid_props of selection = "editWidget"
			tbk_wid_values of selection = "custom,editWidget"
			hide self 
		end conditions
		cnt = itemCount(objects of my parent)
		step i from 2 to cnt
			name of item i of objects of my parent = i - 1
			highlight of item i of objects of my parent = FALSE
			caption of item i of objects of my parent = textline i - 1 of answers
			answerMessage of item i of objects of my parent = item i - 1 of s_answerMessages
		end step
		clear s_answerMessages
		step i from 3 to cnt
			position of item i of objects of my parent = item 1 of bounds of item i - 1 of objects of my parent,item 4 of bounds of item i - 1 of objects of my parent
			size of item i of objects of my parent = size of item 2 of objects of my parent
		end step
		my bounds = bounds of item 2 of objects of my parent	
		return 1
		lockScreen of this window = FALSE
	when ctrlName = "Button cancel"
		get endTBKDialog(hDlg,0) -- 0 = annuler
 	end conditions
	return 0
end TBKDialogCommand

to get objLayer	obj
	while object of obj is not in "page,background"
		obj = parent of obj
	end while
	return obj
end objLayer

notifyBefore customEdit obj
	if (obj is in objects of my parent or obj = my parent) and (sysLevel = "reader")
		send customEdit
		break to system
	end if
end customEdit

notifyBefore reader
	hide self
	my bounds = bounds of item 2 of objects of my parent
end reader

notifyBefore enterPage
	checked of my parent = FALSE
end enterPage

notifyBefore author
	checked of my parent = FALSE
end author
----------------------------------------------------------------------
Rectangle id 114 ("widgetParent") of Page id 251 (p. 152)
----------------------------------------------------------------------
--	Tim Pearson, Asymetrix	1/94

to handle customEdit
	system			s_answerMessages
	local			init, box, answers
	local	LONG	i

	linkDLL sysToolBookDirectory & "tbdlg.dll"
		STRING	DialogCallback		(WORD,STRING,STRING,STRING)
		STRING	SetValue			(STRING,STRING,STRING)
		STRING 	GetValue			(STRING,STRING)
		INT		AddListBoxItem		(WORD,STRING,STRING,INT,INT)
		INT		DeletenListBoxItem	(WORD,STRING,INT)
		INT		EnableControl		(WORD,STRING,INT)
		STRING	GetControlText		(WORD,STRING)
		STRING	GetDialogFocus		(WORD)
		STRING	GetListBoxItems		(WORD,STRING)
		STRING	GetListBoxSelection	(WORD,STRING)
		STRING	GetnListBoxSelection(WORD,STRING)
		INT		SetControlText		(WORD,STRING,STRING)
		INT		SetDialogFocus		(WORD,STRING)
		INT		SetListBoxItems		(WORD,STRING,STRING)
		INT		SetnListBoxSelection(WORD,STRING,STRING)
		INT 	endTBKDialog		(WORD,INT)
	end linkDLL
	
	init = ",G3597,Answers:,S3603,Message to Send When Chosen:LISTBOX answers,L3596,BUTtoN add,B3600,NODISMISSBUTtoN delete,B3601,NODISMISSBUTtoN edit,B3602,NODISMISSEDIT message,E3604,BUTtoN ok,B1,TRUEBUTtoN cancel,B3606,FALSE"
	
box = "524480,9,25,25,228,104,,,Edit Multiple Choice,8,MS Sans Serif,,2,4,171,80,3597,1342177287,128,Answers:,0,,5,59,125,7,3603,1342177280,130,Text,0,answers,5,17,124,39,3596,1352728577,131,,0,add,133,17,37,12,3600,1342242816,128,&Add,0,delete,133,31,37,12,3601,1342242816,128,&Delete,0,edit,133,45,37,12,3602,1342242816,128,&Edit...,0,message,5,69,124,11,3604,1350631552,129,,0,ok,178,7,44,12,1,1342242817,128,OK,0,cancel,178,22,44,12,3606,1342242816,128,Cancel,0"

	step i from 2 to itemCount(objects of my parent)
		textline i - 1 of answers = caption of item i of objects of my parent
		item i - 1 of s_answerMessages = answerMessage of item i of objects of my parent
	end step
	set init to SetValue(init,"listBox answers",answers)
	get DialogCallback(windowhandle of this window,box,init,self)
	clear sysError
	unlinkDLL sysToolBookDirectory & "tbdlg.dll"
end customEdit

to get TBKDialogInit	hDlg,ctrlId,hWnd,msg,ctrlName
	local			answers, cnt

	get SetnListBoxSelection(hDlg,"listBox answers",1)
	get SetControlText(hDlg,"edit message",GetListBoxSelection(hDlg,"listBox answers"))
	answers = GetListBoxItems(hDlg,"listbox answers")
	cnt = textlineCount(answers)
	if cnt <= 1
		get EnableControl(hDlg,"button delete",0)
	else
		get EnableControl(hDlg,"button delete",1)
	end if
	return 1
end TBKDialogInit

to get TBKDialogCommand	hDlg,ctrlId,hWnd,msg,ctrlName
	system			s_answerMessages
	local	OBJECT	thisLayer
	local	LONG	i
	local			sel, foc, answers, newAnswer, cnt, answerCount, oldScript

	conditions
	when ctrlName = "LISTBOX answers"
		conditions
		when msg = 1
		when msg = 4
			get GetnListBoxSelection(hDlg,"listBox answers")
			get SetControlText(hDlg,"edit message",item it of s_answerMessages)
		when msg = 2
			sel = GetnListBoxSelection(hDlg,"listBox answers")
			foc	= GetDialogFocus(hDlg)
			clear sysError
			ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
			if sysError <> "Cancel"
				newAnswer = it
				answers = GetListBoxItems(hDlg,"listbox answers")
				textline sel of answers = newAnswer
				get SetListBoxItems(hDlg,"listBox answers",answers)
				get SetnListBoxSelection(hDlg,"listBox answers",sel)
				get SetDialogFocus(hDlg,foc)
			end if
		end conditions
	when ctrlName = "Button add"
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers) + 1
		get AddListBoxItem(hDlg,"listBox answers","Answer &" & cnt,-1,0)
		item cnt of s_answerMessages = "answer" & cnt
		get SetnListBoxSelection(hDlg,"listBox answers",cnt)
		get SetControlText(hDlg,"edit message","answer" & cnt)
		get EnableControl(hDlg,"button delete",1)
	when ctrlName = "Button delete"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers)
		if sel <> NULL and cnt > 1
			get DeletenListBoxItem(hDlg,"listBox answers",sel)
			clear item sel of s_answerMessages
			if sel = cnt
				decrement sel
			end if
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetControlText(hDlg,"edit message",item sel of s_answerMessages)
			if cnt - 1 <= 1
				get EnableControl(hDlg,"button delete",0)
			else
				get EnableControl(hDlg,"button delete",1)
			end if
		end if
	when ctrlName = "Button edit"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		foc	= GetDialogFocus(hDlg)
		clear sysError
		ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
		if sysError <> "Cancel"
			newAnswer = it
			answers = GetListBoxItems(hDlg,"listbox answers")
			textline sel of answers = newAnswer
			get SetListBoxItems(hDlg,"listBox answers",answers)
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetDialogFocus(hDlg,foc)
		end if
	when ctrlName = "EDIT message"
		if msg = 512
			get GetnListBoxSelection(hDlg,"listBox answers")
			item it of s_answerMessages = GetControlText(hDlg,"edit message")
		end if
	when ctrlName = "Button ok"
		lockScreen of this window = TRUE
		cnt = itemCount(objects of my parent) - 1
		answers = GetListBoxItems(hDlg,"listbox answers")
		answerCount = textlineCount(answers)
		conditions
		when answerCount < cnt
			while itemCount(objects of my parent) - 1 > answerCount
				select last item of objects of my parent
				send clear
			end while
		when answerCount > cnt
			step i from 2 to cnt + 1
				name of item i of objects of my parent = "newAnswer" & (i - 1)
			end step
			step i from cnt + 1 to answerCount
				draw button from items 1 to 2 of bounds of item 2 of objects of my parent to items 3 to 4 of bounds of item 2 of objects of my parent
				borderStyle of selection = borderStyle of item 2 of objects of my parent
				name of selection = "newAnswer" & i
				caption of selection = "Answer &" & i
			end step
			cnt = answerCount
			thisLayer = objLayer(self)
			select my parent
			oldScript = script of selection
			send ungroup
			show self
			select self
			step i from 1 to cnt
				get "button" && QUOTE & "newAnswer" & i & QUOTE && "of" && thisLayer
				extend select it
			end step
			send group
			if oldScript = NULL
				script of selection = \
				  "to handle buttonClick" & CRLF & \
				  TAB & "send (answerMessage of target) to target" & CRLF & \
				  "end" & CRLF & CRLF & \
				  "to set editWidget" & CRLF & \
				  TAB & "send customEdit to item 1 of my objects" & CRLF & \
				  "end"
			else
				script of selection = oldScript
			end if
			autoRadioButtons of selection = TRUE
			tbk_wid_name of selection = "Multiple Choice"
			tbk_wid_props of selection = "editWidget"
			tbk_wid_values of selection = "custom,editWidget"
			hide self 
		end conditions
		cnt = itemCount(objects of my parent)
		step i from 2 to cnt
			name of item i of objects of my parent = i - 1
			highlight of item i of objects of my parent = FALSE
			caption of item i of objects of my parent = textline i - 1 of answers
			answerMessage of item i of objects of my parent = item i - 1 of s_answerMessages
		end step
		clear s_answerMessages
		step i from 3 to cnt
			position of item i of objects of my parent = item 1 of bounds of item i - 1 of objects of my parent,item 4 of bounds of item i - 1 of objects of my parent
			size of item i of objects of my parent = size of item 2 of objects of my parent
		end step
		my bounds = bounds of item 2 of objects of my parent	
		return 1
		lockScreen of this window = FALSE
	when ctrlName = "Button cancel"
		get endTBKDialog(hDlg,0) -- 0 = annuler
 	end conditions
	return 0
end TBKDialogCommand

to get objLayer	obj
	while object of obj is not in "page,background"
		obj = parent of obj
	end while
	return obj
end objLayer

notifyBefore customEdit obj
	if (obj is in objects of my parent or obj = my parent) and (sysLevel = "reader")
		send customEdit
		break to system
	end if
end customEdit

notifyBefore reader
	hide self
	my bounds = bounds of item 2 of objects of my parent
end reader

notifyBefore enterPage
	checked of my parent = FALSE
end enterPage

notifyBefore author
	checked of my parent = FALSE
end author
----------------------------------------------------------------------
Rectangle id 107 ("widgetParent") of Page id 251 (p. 152)
----------------------------------------------------------------------
--	Tim Pearson, Asymetrix	1/94

to handle customEdit
	system			s_answerMessages
	local			init, box, answers
	local	LONG	i

	linkDLL sysToolBookDirectory & "tbdlg.dll"
		STRING	DialogCallback		(WORD,STRING,STRING,STRING)
		STRING	SetValue			(STRING,STRING,STRING)
		STRING 	GetValue			(STRING,STRING)
		INT		AddListBoxItem		(WORD,STRING,STRING,INT,INT)
		INT		DeletenListBoxItem	(WORD,STRING,INT)
		INT		EnableControl		(WORD,STRING,INT)
		STRING	GetControlText		(WORD,STRING)
		STRING	GetDialogFocus		(WORD)
		STRING	GetListBoxItems		(WORD,STRING)
		STRING	GetListBoxSelection	(WORD,STRING)
		STRING	GetnListBoxSelection(WORD,STRING)
		INT		SetControlText		(WORD,STRING,STRING)
		INT		SetDialogFocus		(WORD,STRING)
		INT		SetListBoxItems		(WORD,STRING,STRING)
		INT		SetnListBoxSelection(WORD,STRING,STRING)
		INT 	endTBKDialog		(WORD,INT)
	end linkDLL
	
	init = ",G3597,Answers:,S3603,Message to Send When Chosen:LISTBOX answers,L3596,BUTtoN add,B3600,NODISMISSBUTtoN delete,B3601,NODISMISSBUTtoN edit,B3602,NODISMISSEDIT message,E3604,BUTtoN ok,B1,TRUEBUTtoN cancel,B3606,FALSE"
	
box = "524480,9,25,25,228,104,,,Edit Multiple Choice,8,MS Sans Serif,,2,4,171,80,3597,1342177287,128,Answers:,0,,5,59,125,7,3603,1342177280,130,Text,0,answers,5,17,124,39,3596,1352728577,131,,0,add,133,17,37,12,3600,1342242816,128,&Add,0,delete,133,31,37,12,3601,1342242816,128,&Delete,0,edit,133,45,37,12,3602,1342242816,128,&Edit...,0,message,5,69,124,11,3604,1350631552,129,,0,ok,178,7,44,12,1,1342242817,128,OK,0,cancel,178,22,44,12,3606,1342242816,128,Cancel,0"

	step i from 2 to itemCount(objects of my parent)
		textline i - 1 of answers = caption of item i of objects of my parent
		item i - 1 of s_answerMessages = answerMessage of item i of objects of my parent
	end step
	set init to SetValue(init,"listBox answers",answers)
	get DialogCallback(windowhandle of this window,box,init,self)
	clear sysError
	unlinkDLL sysToolBookDirectory & "tbdlg.dll"
end customEdit

to get TBKDialogInit	hDlg,ctrlId,hWnd,msg,ctrlName
	local			answers, cnt

	get SetnListBoxSelection(hDlg,"listBox answers",1)
	get SetControlText(hDlg,"edit message",GetListBoxSelection(hDlg,"listBox answers"))
	answers = GetListBoxItems(hDlg,"listbox answers")
	cnt = textlineCount(answers)
	if cnt <= 1
		get EnableControl(hDlg,"button delete",0)
	else
		get EnableControl(hDlg,"button delete",1)
	end if
	return 1
end TBKDialogInit

to get TBKDialogCommand	hDlg,ctrlId,hWnd,msg,ctrlName
	system			s_answerMessages
	local	OBJECT	thisLayer
	local	LONG	i
	local			sel, foc, answers, newAnswer, cnt, answerCount, oldScript

	conditions
	when ctrlName = "LISTBOX answers"
		conditions
		when msg = 1
		when msg = 4
			get GetnListBoxSelection(hDlg,"listBox answers")
			get SetControlText(hDlg,"edit message",item it of s_answerMessages)
		when msg = 2
			sel = GetnListBoxSelection(hDlg,"listBox answers")
			foc	= GetDialogFocus(hDlg)
			clear sysError
			ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
			if sysError <> "Cancel"
				newAnswer = it
				answers = GetListBoxItems(hDlg,"listbox answers")
				textline sel of answers = newAnswer
				get SetListBoxItems(hDlg,"listBox answers",answers)
				get SetnListBoxSelection(hDlg,"listBox answers",sel)
				get SetDialogFocus(hDlg,foc)
			end if
		end conditions
	when ctrlName = "Button add"
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers) + 1
		get AddListBoxItem(hDlg,"listBox answers","Answer &" & cnt,-1,0)
		item cnt of s_answerMessages = "answer" & cnt
		get SetnListBoxSelection(hDlg,"listBox answers",cnt)
		get SetControlText(hDlg,"edit message","answer" & cnt)
		get EnableControl(hDlg,"button delete",1)
	when ctrlName = "Button delete"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers)
		if sel <> NULL and cnt > 1
			get DeletenListBoxItem(hDlg,"listBox answers",sel)
			clear item sel of s_answerMessages
			if sel = cnt
				decrement sel
			end if
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetControlText(hDlg,"edit message",item sel of s_answerMessages)
			if cnt - 1 <= 1
				get EnableControl(hDlg,"button delete",0)
			else
				get EnableControl(hDlg,"button delete",1)
			end if
		end if
	when ctrlName = "Button edit"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		foc	= GetDialogFocus(hDlg)
		clear sysError
		ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
		if sysError <> "Cancel"
			newAnswer = it
			answers = GetListBoxItems(hDlg,"listbox answers")
			textline sel of answers = newAnswer
			get SetListBoxItems(hDlg,"listBox answers",answers)
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetDialogFocus(hDlg,foc)
		end if
	when ctrlName = "EDIT message"
		if msg = 512
			get GetnListBoxSelection(hDlg,"listBox answers")
			item it of s_answerMessages = GetControlText(hDlg,"edit message")
		end if
	when ctrlName = "Button ok"
		lockScreen of this window = TRUE
		cnt = itemCount(objects of my parent) - 1
		answers = GetListBoxItems(hDlg,"listbox answers")
		answerCount = textlineCount(answers)
		conditions
		when answerCount < cnt
			while itemCount(objects of my parent) - 1 > answerCount
				select last item of objects of my parent
				send clear
			end while
		when answerCount > cnt
			step i from 2 to cnt + 1
				name of item i of objects of my parent = "newAnswer" & (i - 1)
			end step
			step i from cnt + 1 to answerCount
				draw button from items 1 to 2 of bounds of item 2 of objects of my parent to items 3 to 4 of bounds of item 2 of objects of my parent
				borderStyle of selection = borderStyle of item 2 of objects of my parent
				name of selection = "newAnswer" & i
				caption of selection = "Answer &" & i
			end step
			cnt = answerCount
			thisLayer = objLayer(self)
			select my parent
			oldScript = script of selection
			send ungroup
			show self
			select self
			step i from 1 to cnt
				get "button" && QUOTE & "newAnswer" & i & QUOTE && "of" && thisLayer
				extend select it
			end step
			send group
			if oldScript = NULL
				script of selection = \
				  "to handle buttonClick" & CRLF & \
				  TAB & "send (answerMessage of target) to target" & CRLF & \
				  "end" & CRLF & CRLF & \
				  "to set editWidget" & CRLF & \
				  TAB & "send customEdit to item 1 of my objects" & CRLF & \
				  "end"
			else
				script of selection = oldScript
			end if
			autoRadioButtons of selection = TRUE
			tbk_wid_name of selection = "Multiple Choice"
			tbk_wid_props of selection = "editWidget"
			tbk_wid_values of selection = "custom,editWidget"
			hide self 
		end conditions
		cnt = itemCount(objects of my parent)
		step i from 2 to cnt
			name of item i of objects of my parent = i - 1
			highlight of item i of objects of my parent = FALSE
			caption of item i of objects of my parent = textline i - 1 of answers
			answerMessage of item i of objects of my parent = item i - 1 of s_answerMessages
		end step
		clear s_answerMessages
		step i from 3 to cnt
			position of item i of objects of my parent = item 1 of bounds of item i - 1 of objects of my parent,item 4 of bounds of item i - 1 of objects of my parent
			size of item i of objects of my parent = size of item 2 of objects of my parent
		end step
		my bounds = bounds of item 2 of objects of my parent	
		return 1
		lockScreen of this window = FALSE
	when ctrlName = "Button cancel"
		get endTBKDialog(hDlg,0) -- 0 = annuler
 	end conditions
	return 0
end TBKDialogCommand

to get objLayer	obj
	while object of obj is not in "page,background"
		obj = parent of obj
	end while
	return obj
end objLayer

notifyBefore customEdit obj
	if (obj is in objects of my parent or obj = my parent) and (sysLevel = "reader")
		send customEdit
		break to system
	end if
end customEdit

notifyBefore reader
	hide self
	my bounds = bounds of item 2 of objects of my parent
end reader

notifyBefore enterPage
	checked of my parent = FALSE
end enterPage

notifyBefore author
	checked of my parent = FALSE
end author
----------------------------------------------------------------------
Rectangle id 100 ("widgetParent") of Page id 251 (p. 152)
----------------------------------------------------------------------
--	Tim Pearson, Asymetrix	1/94

to handle customEdit
	system			s_answerMessages
	local			init, box, answers
	local	LONG	i

	linkDLL sysToolBookDirectory & "tbdlg.dll"
		STRING	DialogCallback		(WORD,STRING,STRING,STRING)
		STRING	SetValue			(STRING,STRING,STRING)
		STRING 	GetValue			(STRING,STRING)
		INT		AddListBoxItem		(WORD,STRING,STRING,INT,INT)
		INT		DeletenListBoxItem	(WORD,STRING,INT)
		INT		EnableControl		(WORD,STRING,INT)
		STRING	GetControlText		(WORD,STRING)
		STRING	GetDialogFocus		(WORD)
		STRING	GetListBoxItems		(WORD,STRING)
		STRING	GetListBoxSelection	(WORD,STRING)
		STRING	GetnListBoxSelection(WORD,STRING)
		INT		SetControlText		(WORD,STRING,STRING)
		INT		SetDialogFocus		(WORD,STRING)
		INT		SetListBoxItems		(WORD,STRING,STRING)
		INT		SetnListBoxSelection(WORD,STRING,STRING)
		INT 	endTBKDialog		(WORD,INT)
	end linkDLL
	
	init = ",G3597,Answers:,S3603,Message to Send When Chosen:LISTBOX answers,L3596,BUTtoN add,B3600,NODISMISSBUTtoN delete,B3601,NODISMISSBUTtoN edit,B3602,NODISMISSEDIT message,E3604,BUTtoN ok,B1,TRUEBUTtoN cancel,B3606,FALSE"
	
box = "524480,9,25,25,228,104,,,Edit Multiple Choice,8,MS Sans Serif,,2,4,171,80,3597,1342177287,128,Answers:,0,,5,59,125,7,3603,1342177280,130,Text,0,answers,5,17,124,39,3596,1352728577,131,,0,add,133,17,37,12,3600,1342242816,128,&Add,0,delete,133,31,37,12,3601,1342242816,128,&Delete,0,edit,133,45,37,12,3602,1342242816,128,&Edit...,0,message,5,69,124,11,3604,1350631552,129,,0,ok,178,7,44,12,1,1342242817,128,OK,0,cancel,178,22,44,12,3606,1342242816,128,Cancel,0"

	step i from 2 to itemCount(objects of my parent)
		textline i - 1 of answers = caption of item i of objects of my parent
		item i - 1 of s_answerMessages = answerMessage of item i of objects of my parent
	end step
	set init to SetValue(init,"listBox answers",answers)
	get DialogCallback(windowhandle of this window,box,init,self)
	clear sysError
	unlinkDLL sysToolBookDirectory & "tbdlg.dll"
end customEdit

to get TBKDialogInit	hDlg,ctrlId,hWnd,msg,ctrlName
	local			answers, cnt

	get SetnListBoxSelection(hDlg,"listBox answers",1)
	get SetControlText(hDlg,"edit message",GetListBoxSelection(hDlg,"listBox answers"))
	answers = GetListBoxItems(hDlg,"listbox answers")
	cnt = textlineCount(answers)
	if cnt <= 1
		get EnableControl(hDlg,"button delete",0)
	else
		get EnableControl(hDlg,"button delete",1)
	end if
	return 1
end TBKDialogInit

to get TBKDialogCommand	hDlg,ctrlId,hWnd,msg,ctrlName
	system			s_answerMessages
	local	OBJECT	thisLayer
	local	LONG	i
	local			sel, foc, answers, newAnswer, cnt, answerCount, oldScript

	conditions
	when ctrlName = "LISTBOX answers"
		conditions
		when msg = 1
		when msg = 4
			get GetnListBoxSelection(hDlg,"listBox answers")
			get SetControlText(hDlg,"edit message",item it of s_answerMessages)
		when msg = 2
			sel = GetnListBoxSelection(hDlg,"listBox answers")
			foc	= GetDialogFocus(hDlg)
			clear sysError
			ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
			if sysError <> "Cancel"
				newAnswer = it
				answers = GetListBoxItems(hDlg,"listbox answers")
				textline sel of answers = newAnswer
				get SetListBoxItems(hDlg,"listBox answers",answers)
				get SetnListBoxSelection(hDlg,"listBox answers",sel)
				get SetDialogFocus(hDlg,foc)
			end if
		end conditions
	when ctrlName = "Button add"
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers) + 1
		get AddListBoxItem(hDlg,"listBox answers","Answer &" & cnt,-1,0)
		item cnt of s_answerMessages = "answer" & cnt
		get SetnListBoxSelection(hDlg,"listBox answers",cnt)
		get SetControlText(hDlg,"edit message","answer" & cnt)
		get EnableControl(hDlg,"button delete",1)
	when ctrlName = "Button delete"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers)
		if sel <> NULL and cnt > 1
			get DeletenListBoxItem(hDlg,"listBox answers",sel)
			clear item sel of s_answerMessages
			if sel = cnt
				decrement sel
			end if
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetControlText(hDlg,"edit message",item sel of s_answerMessages)
			if cnt - 1 <= 1
				get EnableControl(hDlg,"button delete",0)
			else
				get EnableControl(hDlg,"button delete",1)
			end if
		end if
	when ctrlName = "Button edit"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		foc	= GetDialogFocus(hDlg)
		clear sysError
		ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
		if sysError <> "Cancel"
			newAnswer = it
			answers = GetListBoxItems(hDlg,"listbox answers")
			textline sel of answers = newAnswer
			get SetListBoxItems(hDlg,"listBox answers",answers)
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetDialogFocus(hDlg,foc)
		end if
	when ctrlName = "EDIT message"
		if msg = 512
			get GetnListBoxSelection(hDlg,"listBox answers")
			item it of s_answerMessages = GetControlText(hDlg,"edit message")
		end if
	when ctrlName = "Button ok"
		lockScreen of this window = TRUE
		cnt = itemCount(objects of my parent) - 1
		answers = GetListBoxItems(hDlg,"listbox answers")
		answerCount = textlineCount(answers)
		conditions
		when answerCount < cnt
			while itemCount(objects of my parent) - 1 > answerCount
				select last item of objects of my parent
				send clear
			end while
		when answerCount > cnt
			step i from 2 to cnt + 1
				name of item i of objects of my parent = "newAnswer" & (i - 1)
			end step
			step i from cnt + 1 to answerCount
				draw button from items 1 to 2 of bounds of item 2 of objects of my parent to items 3 to 4 of bounds of item 2 of objects of my parent
				borderStyle of selection = borderStyle of item 2 of objects of my parent
				name of selection = "newAnswer" & i
				caption of selection = "Answer &" & i
			end step
			cnt = answerCount
			thisLayer = objLayer(self)
			select my parent
			oldScript = script of selection
			send ungroup
			show self
			select self
			step i from 1 to cnt
				get "button" && QUOTE & "newAnswer" & i & QUOTE && "of" && thisLayer
				extend select it
			end step
			send group
			if oldScript = NULL
				script of selection = \
				  "to handle buttonClick" & CRLF & \
				  TAB & "send (answerMessage of target) to target" & CRLF & \
				  "end" & CRLF & CRLF & \
				  "to set editWidget" & CRLF & \
				  TAB & "send customEdit to item 1 of my objects" & CRLF & \
				  "end"
			else
				script of selection = oldScript
			end if
			autoRadioButtons of selection = TRUE
			tbk_wid_name of selection = "Multiple Choice"
			tbk_wid_props of selection = "editWidget"
			tbk_wid_values of selection = "custom,editWidget"
			hide self 
		end conditions
		cnt = itemCount(objects of my parent)
		step i from 2 to cnt
			name of item i of objects of my parent = i - 1
			highlight of item i of objects of my parent = FALSE
			caption of item i of objects of my parent = textline i - 1 of answers
			answerMessage of item i of objects of my parent = item i - 1 of s_answerMessages
		end step
		clear s_answerMessages
		step i from 3 to cnt
			position of item i of objects of my parent = item 1 of bounds of item i - 1 of objects of my parent,item 4 of bounds of item i - 1 of objects of my parent
			size of item i of objects of my parent = size of item 2 of objects of my parent
		end step
		my bounds = bounds of item 2 of objects of my parent	
		return 1
		lockScreen of this window = FALSE
	when ctrlName = "Button cancel"
		get endTBKDialog(hDlg,0) -- 0 = annuler
 	end conditions
	return 0
end TBKDialogCommand

to get objLayer	obj
	while object of obj is not in "page,background"
		obj = parent of obj
	end while
	return obj
end objLayer

notifyBefore customEdit obj
	if (obj is in objects of my parent or obj = my parent) and (sysLevel = "reader")
		send customEdit
		break to system
	end if
end customEdit

notifyBefore reader
	hide self
	my bounds = bounds of item 2 of objects of my parent
end reader

notifyBefore enterPage
	checked of my parent = FALSE
end enterPage

notifyBefore author
	checked of my parent = FALSE
end author
----------------------------------------------------------------------
Rectangle id 93 ("widgetParent") of Page id 251 (p. 152)
----------------------------------------------------------------------
--	Tim Pearson, Asymetrix	1/94

to handle customEdit
	system			s_answerMessages
	local			init, box, answers
	local	LONG	i

	linkDLL sysToolBookDirectory & "tbdlg.dll"
		STRING	DialogCallback		(WORD,STRING,STRING,STRING)
		STRING	SetValue			(STRING,STRING,STRING)
		STRING 	GetValue			(STRING,STRING)
		INT		AddListBoxItem		(WORD,STRING,STRING,INT,INT)
		INT		DeletenListBoxItem	(WORD,STRING,INT)
		INT		EnableControl		(WORD,STRING,INT)
		STRING	GetControlText		(WORD,STRING)
		STRING	GetDialogFocus		(WORD)
		STRING	GetListBoxItems		(WORD,STRING)
		STRING	GetListBoxSelection	(WORD,STRING)
		STRING	GetnListBoxSelection(WORD,STRING)
		INT		SetControlText		(WORD,STRING,STRING)
		INT		SetDialogFocus		(WORD,STRING)
		INT		SetListBoxItems		(WORD,STRING,STRING)
		INT		SetnListBoxSelection(WORD,STRING,STRING)
		INT 	endTBKDialog		(WORD,INT)
	end linkDLL
	
	init = ",G3597,Answers:,S3603,Message to Send When Chosen:LISTBOX answers,L3596,BUTtoN add,B3600,NODISMISSBUTtoN delete,B3601,NODISMISSBUTtoN edit,B3602,NODISMISSEDIT message,E3604,BUTtoN ok,B1,TRUEBUTtoN cancel,B3606,FALSE"
	
box = "524480,9,25,25,228,104,,,Edit Multiple Choice,8,MS Sans Serif,,2,4,171,80,3597,1342177287,128,Answers:,0,,5,59,125,7,3603,1342177280,130,Text,0,answers,5,17,124,39,3596,1352728577,131,,0,add,133,17,37,12,3600,1342242816,128,&Add,0,delete,133,31,37,12,3601,1342242816,128,&Delete,0,edit,133,45,37,12,3602,1342242816,128,&Edit...,0,message,5,69,124,11,3604,1350631552,129,,0,ok,178,7,44,12,1,1342242817,128,OK,0,cancel,178,22,44,12,3606,1342242816,128,Cancel,0"

	step i from 2 to itemCount(objects of my parent)
		textline i - 1 of answers = caption of item i of objects of my parent
		item i - 1 of s_answerMessages = answerMessage of item i of objects of my parent
	end step
	set init to SetValue(init,"listBox answers",answers)
	get DialogCallback(windowhandle of this window,box,init,self)
	clear sysError
	unlinkDLL sysToolBookDirectory & "tbdlg.dll"
end customEdit

to get TBKDialogInit	hDlg,ctrlId,hWnd,msg,ctrlName
	local			answers, cnt

	get SetnListBoxSelection(hDlg,"listBox answers",1)
	get SetControlText(hDlg,"edit message",GetListBoxSelection(hDlg,"listBox answers"))
	answers = GetListBoxItems(hDlg,"listbox answers")
	cnt = textlineCount(answers)
	if cnt <= 1
		get EnableControl(hDlg,"button delete",0)
	else
		get EnableControl(hDlg,"button delete",1)
	end if
	return 1
end TBKDialogInit

to get TBKDialogCommand	hDlg,ctrlId,hWnd,msg,ctrlName
	system			s_answerMessages
	local	OBJECT	thisLayer
	local	LONG	i
	local			sel, foc, answers, newAnswer, cnt, answerCount, oldScript

	conditions
	when ctrlName = "LISTBOX answers"
		conditions
		when msg = 1
		when msg = 4
			get GetnListBoxSelection(hDlg,"listBox answers")
			get SetControlText(hDlg,"edit message",item it of s_answerMessages)
		when msg = 2
			sel = GetnListBoxSelection(hDlg,"listBox answers")
			foc	= GetDialogFocus(hDlg)
			clear sysError
			ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
			if sysError <> "Cancel"
				newAnswer = it
				answers = GetListBoxItems(hDlg,"listbox answers")
				textline sel of answers = newAnswer
				get SetListBoxItems(hDlg,"listBox answers",answers)
				get SetnListBoxSelection(hDlg,"listBox answers",sel)
				get SetDialogFocus(hDlg,foc)
			end if
		end conditions
	when ctrlName = "Button add"
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers) + 1
		get AddListBoxItem(hDlg,"listBox answers","Answer &" & cnt,-1,0)
		item cnt of s_answerMessages = "answer" & cnt
		get SetnListBoxSelection(hDlg,"listBox answers",cnt)
		get SetControlText(hDlg,"edit message","answer" & cnt)
		get EnableControl(hDlg,"button delete",1)
	when ctrlName = "Button delete"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers)
		if sel <> NULL and cnt > 1
			get DeletenListBoxItem(hDlg,"listBox answers",sel)
			clear item sel of s_answerMessages
			if sel = cnt
				decrement sel
			end if
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetControlText(hDlg,"edit message",item sel of s_answerMessages)
			if cnt - 1 <= 1
				get EnableControl(hDlg,"button delete",0)
			else
				get EnableControl(hDlg,"button delete",1)
			end if
		end if
	when ctrlName = "Button edit"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		foc	= GetDialogFocus(hDlg)
		clear sysError
		ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
		if sysError <> "Cancel"
			newAnswer = it
			answers = GetListBoxItems(hDlg,"listbox answers")
			textline sel of answers = newAnswer
			get SetListBoxItems(hDlg,"listBox answers",answers)
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetDialogFocus(hDlg,foc)
		end if
	when ctrlName = "EDIT message"
		if msg = 512
			get GetnListBoxSelection(hDlg,"listBox answers")
			item it of s_answerMessages = GetControlText(hDlg,"edit message")
		end if
	when ctrlName = "Button ok"
		lockScreen of this window = TRUE
		cnt = itemCount(objects of my parent) - 1
		answers = GetListBoxItems(hDlg,"listbox answers")
		answerCount = textlineCount(answers)
		conditions
		when answerCount < cnt
			while itemCount(objects of my parent) - 1 > answerCount
				select last item of objects of my parent
				send clear
			end while
		when answerCount > cnt
			step i from 2 to cnt + 1
				name of item i of objects of my parent = "newAnswer" & (i - 1)
			end step
			step i from cnt + 1 to answerCount
				draw button from items 1 to 2 of bounds of item 2 of objects of my parent to items 3 to 4 of bounds of item 2 of objects of my parent
				borderStyle of selection = borderStyle of item 2 of objects of my parent
				name of selection = "newAnswer" & i
				caption of selection = "Answer &" & i
			end step
			cnt = answerCount
			thisLayer = objLayer(self)
			select my parent
			oldScript = script of selection
			send ungroup
			show self
			select self
			step i from 1 to cnt
				get "button" && QUOTE & "newAnswer" & i & QUOTE && "of" && thisLayer
				extend select it
			end step
			send group
			if oldScript = NULL
				script of selection = \
				  "to handle buttonClick" & CRLF & \
				  TAB & "send (answerMessage of target) to target" & CRLF & \
				  "end" & CRLF & CRLF & \
				  "to set editWidget" & CRLF & \
				  TAB & "send customEdit to item 1 of my objects" & CRLF & \
				  "end"
			else
				script of selection = oldScript
			end if
			autoRadioButtons of selection = TRUE
			tbk_wid_name of selection = "Multiple Choice"
			tbk_wid_props of selection = "editWidget"
			tbk_wid_values of selection = "custom,editWidget"
			hide self 
		end conditions
		cnt = itemCount(objects of my parent)
		step i from 2 to cnt
			name of item i of objects of my parent = i - 1
			highlight of item i of objects of my parent = FALSE
			caption of item i of objects of my parent = textline i - 1 of answers
			answerMessage of item i of objects of my parent = item i - 1 of s_answerMessages
		end step
		clear s_answerMessages
		step i from 3 to cnt
			position of item i of objects of my parent = item 1 of bounds of item i - 1 of objects of my parent,item 4 of bounds of item i - 1 of objects of my parent
			size of item i of objects of my parent = size of item 2 of objects of my parent
		end step
		my bounds = bounds of item 2 of objects of my parent	
		return 1
		lockScreen of this window = FALSE
	when ctrlName = "Button cancel"
		get endTBKDialog(hDlg,0) -- 0 = annuler
 	end conditions
	return 0
end TBKDialogCommand

to get objLayer	obj
	while object of obj is not in "page,background"
		obj = parent of obj
	end while
	return obj
end objLayer

notifyBefore customEdit obj
	if (obj is in objects of my parent or obj = my parent) and (sysLevel = "reader")
		send customEdit
		break to system
	end if
end customEdit

notifyBefore reader
	hide self
	my bounds = bounds of item 2 of objects of my parent
end reader

notifyBefore enterPage
	checked of my parent = FALSE
end enterPage

notifyBefore author
	checked of my parent = FALSE
end author
----------------------------------------------------------------------
Rectangle id 74 ("widgetParent") of Page id 251 (p. 152)
----------------------------------------------------------------------
--	Tim Pearson, Asymetrix	1/94

to handle customEdit
	system			s_answerMessages
	local			init, box, answers
	local	LONG	i

	linkDLL sysToolBookDirectory & "tbdlg.dll"
		STRING	DialogCallback		(WORD,STRING,STRING,STRING)
		STRING	SetValue			(STRING,STRING,STRING)
		STRING 	GetValue			(STRING,STRING)
		INT		AddListBoxItem		(WORD,STRING,STRING,INT,INT)
		INT		DeletenListBoxItem	(WORD,STRING,INT)
		INT		EnableControl		(WORD,STRING,INT)
		STRING	GetControlText		(WORD,STRING)
		STRING	GetDialogFocus		(WORD)
		STRING	GetListBoxItems		(WORD,STRING)
		STRING	GetListBoxSelection	(WORD,STRING)
		STRING	GetnListBoxSelection(WORD,STRING)
		INT		SetControlText		(WORD,STRING,STRING)
		INT		SetDialogFocus		(WORD,STRING)
		INT		SetListBoxItems		(WORD,STRING,STRING)
		INT		SetnListBoxSelection(WORD,STRING,STRING)
		INT 	endTBKDialog		(WORD,INT)
	end linkDLL
	
	init = ",G3597,Answers:,S3603,Message to Send When Chosen:LISTBOX answers,L3596,BUTtoN add,B3600,NODISMISSBUTtoN delete,B3601,NODISMISSBUTtoN edit,B3602,NODISMISSEDIT message,E3604,BUTtoN ok,B1,TRUEBUTtoN cancel,B3606,FALSE"
	
box = "524480,9,25,25,228,104,,,Edit Multiple Choice,8,MS Sans Serif,,2,4,171,80,3597,1342177287,128,Answers:,0,,5,59,125,7,3603,1342177280,130,Text,0,answers,5,17,124,39,3596,1352728577,131,,0,add,133,17,37,12,3600,1342242816,128,&Add,0,delete,133,31,37,12,3601,1342242816,128,&Delete,0,edit,133,45,37,12,3602,1342242816,128,&Edit...,0,message,5,69,124,11,3604,1350631552,129,,0,ok,178,7,44,12,1,1342242817,128,OK,0,cancel,178,22,44,12,3606,1342242816,128,Cancel,0"

	step i from 2 to itemCount(objects of my parent)
		textline i - 1 of answers = caption of item i of objects of my parent
		item i - 1 of s_answerMessages = answerMessage of item i of objects of my parent
	end step
	set init to SetValue(init,"listBox answers",answers)
	get DialogCallback(windowhandle of this window,box,init,self)
	clear sysError
	unlinkDLL sysToolBookDirectory & "tbdlg.dll"
end customEdit

to get TBKDialogInit	hDlg,ctrlId,hWnd,msg,ctrlName
	local			answers, cnt

	get SetnListBoxSelection(hDlg,"listBox answers",1)
	get SetControlText(hDlg,"edit message",GetListBoxSelection(hDlg,"listBox answers"))
	answers = GetListBoxItems(hDlg,"listbox answers")
	cnt = textlineCount(answers)
	if cnt <= 1
		get EnableControl(hDlg,"button delete",0)
	else
		get EnableControl(hDlg,"button delete",1)
	end if
	return 1
end TBKDialogInit

to get TBKDialogCommand	hDlg,ctrlId,hWnd,msg,ctrlName
	system			s_answerMessages
	local	OBJECT	thisLayer
	local	LONG	i
	local			sel, foc, answers, newAnswer, cnt, answerCount, oldScript

	conditions
	when ctrlName = "LISTBOX answers"
		conditions
		when msg = 1
		when msg = 4
			get GetnListBoxSelection(hDlg,"listBox answers")
			get SetControlText(hDlg,"edit message",item it of s_answerMessages)
		when msg = 2
			sel = GetnListBoxSelection(hDlg,"listBox answers")
			foc	= GetDialogFocus(hDlg)
			clear sysError
			ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
			if sysError <> "Cancel"
				newAnswer = it
				answers = GetListBoxItems(hDlg,"listbox answers")
				textline sel of answers = newAnswer
				get SetListBoxItems(hDlg,"listBox answers",answers)
				get SetnListBoxSelection(hDlg,"listBox answers",sel)
				get SetDialogFocus(hDlg,foc)
			end if
		end conditions
	when ctrlName = "Button add"
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers) + 1
		get AddListBoxItem(hDlg,"listBox answers","Answer &" & cnt,-1,0)
		item cnt of s_answerMessages = "answer" & cnt
		get SetnListBoxSelection(hDlg,"listBox answers",cnt)
		get SetControlText(hDlg,"edit message","answer" & cnt)
		get EnableControl(hDlg,"button delete",1)
	when ctrlName = "Button delete"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		answers = GetListBoxItems(hDlg,"listbox answers")
		cnt = textlineCount(answers)
		if sel <> NULL and cnt > 1
			get DeletenListBoxItem(hDlg,"listBox answers",sel)
			clear item sel of s_answerMessages
			if sel = cnt
				decrement sel
			end if
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetControlText(hDlg,"edit message",item sel of s_answerMessages)
			if cnt - 1 <= 1
				get EnableControl(hDlg,"button delete",0)
			else
				get EnableControl(hDlg,"button delete",1)
			end if
		end if
	when ctrlName = "Button edit"
		sel = GetnListBoxSelection(hDlg,"listBox answers")
		foc	= GetDialogFocus(hDlg)
		clear sysError
		ask "Répondez ā la question:" with GetListBoxSelection(hDlg,"listBox answers")
		if sysError <> "Cancel"
			newAnswer = it
			answers = GetListBoxItems(hDlg,"listbox answers")
			textline sel of answers = newAnswer
			get SetListBoxItems(hDlg,"listBox answers",answers)
			get SetnListBoxSelection(hDlg,"listBox answers",sel)
			get SetDialogFocus(hDlg,foc)
		end if
	when ctrlName = "EDIT message"
		if msg = 512
			get GetnListBoxSelection(hDlg,"listBox answers")
			item it of s_answerMessages = GetControlText(hDlg,"edit message")
		end if
	when ctrlName = "Button ok"
		lockScreen of this window = TRUE
		cnt = itemCount(objects of my parent) - 1
		answers = GetListBoxItems(hDlg,"listbox answers")
		answerCount = textlineCount(answers)
		conditions
		when answerCount < cnt
			while itemCount(objects of my parent) - 1 > answerCount
				select last item of objects of my parent
				send clear
			end while
		when answerCount > cnt
			step i from 2 to cnt + 1
				name of item i of objects of my parent = "newAnswer" & (i - 1)
			end step
			step i from cnt + 1 to answerCount
				draw button from items 1 to 2 of bounds of item 2 of objects of my parent to items 3 to 4 of bounds of item 2 of objects of my parent
				borderStyle of selection = borderStyle of item 2 of objects of my parent
				name of selection = "newAnswer" & i
				caption of selection = "Answer &" & i
			end step
			cnt = answerCount
			thisLayer = objLayer(self)
			select my parent
			oldScript = script of selection
			send ungroup
			show self
			select self
			step i from 1 to cnt
				get "button" && QUOTE & "newAnswer" & i & QUOTE && "of" && thisLayer
				extend select it
			end step
			send group
			if oldScript = NULL
				script of selection = \
				  "to handle buttonClick" & CRLF & \
				  TAB & "send (answerMessage of target) to target" & CRLF & \
				  "end" & CRLF & CRLF & \
				  "to set editWidget" & CRLF & \
				  TAB & "send customEdit to item 1 of my objects" & CRLF & \
				  "end"
			else
				script of selection = oldScript
			end if
			autoRadioButtons of selection = TRUE
			tbk_wid_name of selection = "Multiple Choice"
			tbk_wid_props of selection = "editWidget"
			tbk_wid_values of selection = "custom,editWidget"
			hide self 
		end conditions
		cnt = itemCount(objects of my parent)
		step i from 2 to cnt
			name of item i of objects of my parent = i - 1
			highlight of item i of objects of my parent = FALSE
			caption of item i of objects of my parent = textline i - 1 of answers
			answerMessage of item i of objects of my parent = item i - 1 of s_answerMessages
		end step
		clear s_answerMessages
		step i from 3 to cnt
			position of item i of objects of my parent = item 1 of bounds of item i - 1 of objects of my parent,item 4 of bounds of item i - 1 of objects of my parent
			size of item i of objects of my parent = size of item 2 of objects of my parent
		end step
		my bounds = bounds of item 2 of objects of my parent	
		return 1
		lockScreen of this window = FALSE
	when ctrlName = "Button cancel"
		get endTBKDialog(hDlg,0) -- 0 = annuler
 	end conditions
	return 0
end TBKDialogCommand

to get objLayer	obj
	while object of obj is not in "page,background"
		obj = parent of obj
	end while
	return obj
end objLayer

notifyBefore customEdit obj
	if (obj is in objects of my parent or obj = my parent) and (sysLevel = "reader")
		send customEdit
		break to system
	end if
end customEdit

notifyBefore reader
	hide self
	my bounds = bounds of item 2 of objects of my parent
end reader

notifyBefore enterPage
	checked of my parent = FALSE
end enterPage

notifyBefore author
	checked of my parent = FALSE
end author
----------------------------------------------------------------------
Field id 61 ("index") of Page id 251 (p. 152)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	


notifyBefore enterPage
	system ARRAY STRING itemArray[]
	
	fill itemArray with my text in [textline] order
	set my selectedTextlines to 1
	set my scroll to 0
end enterPage

to handle buttonUp
	set text of field "item" to selectedText
	un=text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of field "formes" of this page

end buttonUp


to handle sortSelf
	local ARRAY dataArray[]
	local STRING sortedText
	sysCursor = 4
	-- put the textlines into an array
	fill dataArray with my text in [textline] order
	-- sort the array
	send quickSort dataArray
	-- convert the array back into textlines
	step i from 1 to dimensions(dataArray)
		put dataArray[i] & CRLF after sortedText
	end step
	-- get rid of trailing crlf's
	clear last char of sortedText
	clear last char of sortedText
	-- update the text
	set my text to sortedText
	sysCursor = default
end sortSelf

-- The next three handlers make up a Standard recursive QuickSort.
-- Keep in mind that arrays are passed by reference, not by value.
to handle quickSort fArray[] by reference
	system s_noSwap
	set s_noSwap to 0
    send quickSrt fArray, 1, dimensions ( fArray )
end quickSort

to handle quickSrt fArray[] by reference, lo, hi
    system  s_noSwap
    if hi > lo 
		send swap  fArray, lo, ((lo+hi) div 2)
		set lst to lo
		step i from (lo+1) to hi
        	if fArray[i] < fArray[lo] as text
        		increment lst
        		send swap fArray, lst, i
        	else
        		increment s_noswap
        	end if
        end step
        send swap fArray,lo,lst 
   		send quicksrt fArray, lo, lst-1
    	send quicksrt fArray, lst+1,hi
   	end if
end quickSrt

to handle swap fArray[] by reference, x, y
	local temp
	set temp to fArray[x]
	set fArray[x] to fArray[y]
	set fArray[y] to temp
end swap


-- use if inserting a single line. Will maintain sorted order
to handle insertLine newLine
	set my text to insertLineAux(my text,newLine)
end insertLine

-- inserts newLine into txt, maintaining sorted order.
-- works only if txt is already sorted.
to get insertLineAux txt,newLine
	if txt is null
		return newLine
	end if
	set start to 1  -- first textline
	set tlc to textlinecount(txt)
	set ending to tlc -- last textline
	local insertSpot
	while start <= ending 
		set midPoint to (start+ending) div 2 
		set middleLine to textline midPoint of txt
		conditions
		when newLine < middleLine as text
			-- start looking at values less than current midPoint
			set ending to midPoint-1
			set insertSpot to midPoint
		when newLine > middleLine as text
			-- start looking at values greater than current midPoint
			set start to midPoint+1
			set insertSpot to midPoint+1
		else
			-- the item already exists
			set insertSpot to midPoint
			break while
		end conditions
	end while
	if insertSpot > tlc
		put newLine before textline insertSpot of txt
	else
		put newLine&crlf before textline insertSpot of txt
	end if
	return txt
end insertLineAux
----------------------------------------------------------------------
RecordField id 5 ("llista") of Background id 51
----------------------------------------------------------------------
notifyBefore enterPage
	system ARRAY STRING itemArray[]
	
	fill itemArray with my text in [textline] order
	set my selectedTextlines to 1
	set my scroll to 0
end enterPage

to handle buttonUp
	set text of recordfield "text" to selectedText
end buttonUp


to handle sortSelf
	local ARRAY dataArray[]
	local STRING sortedText
	sysCursor = 4
	-- put the textlines into an array
	fill dataArray with my text in [textline] order
	-- sort the array
	send quickSort dataArray
	-- convert the array back into textlines
	step i from 1 to dimensions(dataArray)
		put dataArray[i] & CRLF after sortedText
	end step
	-- get rid of trailing crlf's
	clear last char of sortedText
	clear last char of sortedText
	-- update the text
	set my text to sortedText
	sysCursor = default
end sortSelf

-- The next three handlers make up a Standard recursive QuickSort.
-- Keep in mind that arrays are passed by reference, not by value.
to handle quickSort fArray[] by reference
	system s_noSwap
	set s_noSwap to 0
    send quickSrt fArray, 1, dimensions ( fArray )
end quickSort

to handle quickSrt fArray[] by reference, lo, hi
    system  s_noSwap
    if hi > lo 
		send swap  fArray, lo, ((lo+hi) div 2)
		set lst to lo
		step i from (lo+1) to hi
        	if fArray[i] < fArray[lo] as text
        		increment lst
        		send swap fArray, lst, i
        	else
        		increment s_noswap
        	end if
        end step
        send swap fArray,lo,lst 
   		send quicksrt fArray, lo, lst-1
    	send quicksrt fArray, lst+1,hi
   	end if
end quickSrt

to handle swap fArray[] by reference, x, y
	local temp
	set temp to fArray[x]
	set fArray[x] to fArray[y]
	set fArray[y] to temp
end swap


-- use if inserting a single line. Will maintain sorted order
to handle insertLine newLine
	set my text to insertLineAux(my text,newLine)
end insertLine

-- inserts newLine into txt, maintaining sorted order.
-- works only if txt is already sorted.
to get insertLineAux txt,newLine
	if txt is null
		return newLine
	end if
	set start to 1  -- first textline
	set tlc to textlinecount(txt)
	set ending to tlc -- last textline
	local insertSpot
	while start <= ending 
		set midPoint to (start+ending) div 2 
		set middleLine to textline midPoint of txt
		conditions
		when newLine < middleLine as text
			-- start looking at values less than current midPoint
			set ending to midPoint-1
			set insertSpot to midPoint
		when newLine > middleLine as text
			-- start looking at values greater than current midPoint
			set start to midPoint+1
			set insertSpot to midPoint+1
		else
			-- the item already exists
			set insertSpot to midPoint
			break while
		end conditions
	end while
	if insertSpot > tlc
		put newLine before textline insertSpot of txt
	else
		put newLine&crlf before textline insertSpot of txt
	end if
	return txt
end insertLineAux


----------------------------------------------------------------------
Page id 257 ("verb") of Book "C:\Signe2\SIGNE2.exe"
----------------------------------------------------------------------
to handle enterPage
	restore menuBar
	disable menuItem "Llegir" at reader	
	disable menu "Lletra" at reader
	disable menu "Pāgina" at reader
	disable menu "Ediciķ" at reader
	disable menu "Categories" at reader
	disable menuItem "Imprimir el text" at reader
	disable menuItem "Imprimir la pāgina" at reader	
	disable menuItem "Conjugar verbs" at reader
	disable menuItem "Importar text" at reader
--	disable menuItem "Editor de text bilingüe" at reader
	disable menuItem "Importar dibuixos d'objectes" at reader
	disable menuItem "Importar filmacions de signes" at reader
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of field "item" of this page
	clear text of recordField "passat" of this page
	clear text of recordField "present" of this page
	clear text of recordField "futur" of this page
	put text of recordfield "llista" of this page into vbenji
	put vbenji into text of field "index" of this page
	clear text of field "caixa" of this page
	vTxte= text of recordField "llista" of this page
	vcompara=text of recordField "verbs" of page "categories1"
		step ctr from 1 to WordCount (vcompara)
			exp= word ctr of vcompara
			if exp is not in vTxte
			put crlf & exp after last word of text of field "caixa" of this page
			end if
		end step	
	focus=field "item" of this page
end	
----------------------------------------------------------------------
Button id 73 ("Aplicar") of Page id 257 (p. 154)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick

		sysCursor=4
		if text of recordfield "primerg1" of this page is null
		request "Heu de clicar un verb i aplicar-li la seva conjugaciķ"
		sysCursor=1
		focus=field "item" of this page
		sysCursor=1
		break
		
		else	
		
		clear contenidor
		vmot=text of field "item" of this page
		put vmot&&space into contenidor
		request "El verb"&& vmot && "es conjugarā en les formes proposades" with "SEGUIR" or "ANULˇLAR"
			conditions
			when It is "ANULˇLAR"
			syscursor = 1
			break
			else
	
	vpassat=text of recordField "passat" of this page
	step ctr from 1 to wordCount(vpassat)
	varrel= word ctr of vpassat
	put space&&varrel after last word of contenidor
	end step
	
	vpresent=text of recordfield "present" of this page
	step ctr from 1 to wordCount(vpresent)
	varrel= word ctr of vpresent
	put space&&varrel after last word of contenidor
	end step

	vfutur=text of recordfield "futur" of this page
	step ctr from 1 to wordCount(vfutur)
	varrel= word ctr of vfutur
	put space&&varrel after last word of contenidor
	end step
	
	search in recordField "llista" for vmot as word
	newLine = vmot
	send insertLine newLine to recordfield "llista" of this page

	search in RecordField "llista" for vmot as word
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	mgrafic=word wmot of the text of field "item" of this page
	insert graphic bitmap vmot after last word of text of recordField "primerg1" of this page
	put vmot after last word of text of recordField "primer1" of this page
	put text of recordfield "llista" of this page into vbenji
	put vbenji into text of field "index" of this page
	clear text of field "caixa" of this page
	vTxte= text of recordField "llista" of this page
	vcompara=text of recordField "verbs" of page "categories1"
		step ctr from 1 to WordCount (vcompara)
			exp= word ctr of vcompara
			if exp is not in vTxte
			put crlf & exp after last word of text of field "caixa" of this page
			end if
		end step	
	focus=field "item" of this page
	clear text of field "item" of this page 
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of field "item" of this page
	clear text of recordField "passat" of this page
	clear text of recordField "present" of this page
	clear text of recordField "futur" of this page
	focus=field "item" of this page
	end conditions
end if

	ae1= "a b c į q "
	fk1= "f g h i j k"
	lņ1= "l ll m n ņ"
	op1= "o p"
	rt1= "r s t"
	uz1= "u v w d e x y z"	
	
	put first char of vmot into davant
	
	if davant is in ae1
	put charCount(text of recordfield "recerca1" of page "recercat1" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat1" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat1" of this book
	end if
	end if	
	if davant is in fk1
	put charCount(text of recordfield "recerca1" of page "recercat2" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat2" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat2" of this book
	end if
	end if
	if davant is in lņ1
	put charCount(text of recordfield "recerca1" of page "recercat3" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat3" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat3" of this book
	end if
	end if
	if davant is in op1
	put charCount(text of recordfield "recerca1" of page "recercat4" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat4" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat4" of this book
	end if
	end if
	if davant is in rt1
	put charCount(text of recordfield "recerca1" of page "recercat5" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat5" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat5" of this book
	end if
	end if
	if davant is in uz1
	put charCount(text of recordfield "recerca1" of page "recercat6" of this book) into dir
	if dir < 31600
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca1" of page "recercat6" of this book
	else
	put CRLF&&contenidor&&CRLF after last word of text of recordField "recerca2" of page "recercat6" of this book
	end if
	end if
	sysCursor=1
end
----------------------------------------------------------------------
Button id 71 ("Acabar") of Page id 257 (p. 154)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		request "Voleu salvar els canvis per a properes sessions?" with "SI" or "NO" or "ANULˇLAR"
			conditions
			when It is "SI"
			syscursor = 4
			clear text of recordField "titol" of page "FRASE"
			clear text of recordField "texte" of page "FRASE"
			save changes to this book
			send exit
			when It is "NO"
			send exit
			when It is "ANULˇLAR"
			break
			end conditions
end	


	
----------------------------------------------------------------------
Button id 69 ("gestio") of Page id 257 (p. 154)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	
to handle buttonClick
	syscursor = 4
	clear text of recordField "titol" of page "frase"
	clear text of recordField "texte" of page "frase"
	go to page "gestio"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 68 ("ajuda") of Page id 257 (p. 154)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
		sysCursor=4
		open viewer "ajuda"
		currentPage of viewer "ajuda" = page "ajuda"
		show viewer "ajuda"
		sysCursor=1
end
----------------------------------------------------------------------
Button id 66 ("frases") of Page id 257 (p. 154)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	syscursor = 4
	clear text of recordField "titol" of page "frase"
	clear text of recordField "texte" of page "frase"
	go to page "frase"
	syscursor = 1
end	
----------------------------------------------------------------------
Button id 59 ("Anulˇlar") of Page id 257 (p. 154)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	

to handle buttonClick
	sysCursor=4
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of field "item" of this page
	clear text of recordField "passat" of this page
	clear text of recordField "present" of this page
	clear text of recordField "futur" of this page
	sysCursor=1
end 


	
----------------------------------------------------------------------
Field id 53 ("index") of Page id 257 (p. 154)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	


to handle buttonClick loc
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of recordfield "passat" of this page
	clear text of recordfield "present" of this page
	clear text of recordfield "futur" of this page
	select textline (item 1 of textFromPoint (loc)) of my text
	put selectedText into text of field "item" of this page
	request "Aquest verb ja estā conjugat. Per modificarlo, primer cal suprimir-lo des de l'EDITOR DE GRĀFICS"
	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of recordfield "passat" of this page
	clear text of recordfield "present" of this page
	clear text of recordfield "futur" of this page
end

----------------------------------------------------------------------
Field id 27 ("caixa") of Page id 257 (p. 154)
----------------------------------------------------------------------
to handle mouseEnter
	sysCursor=44
end

to handle mouseleave
	sysCursor=1
end	


to handle buttonClick loc

	clear text of field "item" of this page
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	clear text of recordfield "passat" of this page
	clear text of recordfield "present" of this page
	clear text of recordfield "futur" of this page

	select textline (item 1 of textFromPoint (loc)) of my text
	put selectedText into text of field "item" of this page
	
	vv= text of field "item" of this page
	put charCount(vv) into nombre
	penul= char nombre -1 of text of field "item" of this page
	ultim= char nombre of text of field "item" of this page
	termina= penul&ultim
	clear control
	if termina="ar"
	put 1 into control
	end if
	if termina="er"
	put 2 into control
	end if
	if termina="re"
	put 2 into control
	end if
	if termina="ir"
	put 3 into control
	end if

	
		vmot=text of field "item" of this page
		insert graphic bitmap vmot after last word of text of recordField "primerg1" of this page
		put vmot after last word of text of recordField "primer1" of this page
		clear varrel	
			step ctr from 1 to charCount(vmot)-2
			vcaracter=char ctr of (vmot)
			put vcaracter after last char of varrel
			end step

			search in RecordField "llista" for varrel as word
			send clear

			if control=1

			put varrel &"ava" & crlf & varrel & "aves"& crlf & varrel & "ava"& crlf & varrel & "āvem" & crlf & varrel & "āveu" & crlf & varrel & "aven" into text of recordField "passat" of this page
	
			put varrel &"o" & crlf & varrel & "es"& crlf & varrel & "a" & crlf & varrel & "em" & crlf & varrel & "eu" & crlf & varrel & "en" into text of recordField "present" of this page
		
			put varrel &"aré" & crlf & varrel & "arās"& crlf & varrel & "arā"& crlf & varrel & "arem" & crlf & varrel & "areu" & crlf & varrel & "aran" into text of recordField "futur" of this page

			end if
			
		if control=2
		
		put varrel &"ia" & crlf & varrel & "ies"& crlf & varrel & "ia"& crlf & varrel & "íem" & crlf & varrel & "íeu" & crlf & varrel & "ien" into text of recordField "passat" of this page
		
		put varrel &"o" & crlf & varrel & "es"& crlf & varrel &"e" & crlf & varrel & "em" & crlf & varrel & "eu" & crlf & varrel & "en" into text of recordField "present" of this page
		
		put varrel &"eré" & crlf & varrel & "erās"& crlf & varrel & "erā"& crlf & varrel & "erem" & crlf & varrel & "ereu" & crlf & varrel & "eran" into text of recordField "futur" of this page
		
		end if
			
		if control=3
		
		put varrel &"ia" & crlf & varrel & "ies"& crlf & varrel & "ia"& crlf & varrel & "íem" & crlf & varrel & "íeu" & crlf & varrel & "ien" into text of recordField "passat" of this page
		
		put varrel &"eixo" & crlf & varrel & "eixes"& crlf & varrel & "eix"& crlf & varrel & "im" & crlf & varrel & "iu" & crlf & varrel & "eixen" into text of recordField "present" of this page
		
		put varrel &"iré" & crlf & varrel & "irās"& crlf & varrel & "irā"& crlf & varrel & "irem" & crlf & varrel & "ireu" & crlf & varrel & "iran" into text of recordField "futur" of this page
		end if
		
		if control is null
		put varrel &"ava" & crlf & varrel & "aves"& crlf & varrel & "ava"& crlf & varrel & "āvem" & crlf & varrel & "āveu" & crlf & varrel & "aven" into text of recordField "passat" of this page
		
		put varrel &"o" & crlf & varrel & "es"& crlf & varrel & "a"& crlf & varrel & "em" & crlf & varrel & "eu" & crlf & varrel & "en" into text of recordField "present" of this page
		
		put varrel &"aré" & crlf & varrel & "arās"& crlf & varrel & "arā"& crlf & varrel & "arem" & crlf & varrel & "areu" & crlf & varrel & "aran" into text of recordField "futur" of this page

		end if	

end

----------------------------------------------------------------------
Field id 14 ("item") of Page id 257 (p. 154)
----------------------------------------------------------------------
to handle buttonClick
	sysCursor=4

	Request "Per seleccionar verbs heu de clicar sobre els de la llista de VERBS NO CONJUGAT"

	sysCursor=1
end	

to handle keyChar
	system ARRAY STRING itemArray[]
	
	local WORD itemNumber, stringLength
	local STRING string
	
	--vérifie que la matrice est initialisée
	if itemArray[1] = null
		--sinon, initialisez-la
		sendnotifyBefore enterPage to field "index"
	end if
	
	--fait suivre le caractčre tapé pour que le nouveau caractčre soit placé dans le champ
	forward
	
	--verrouille l'écran pendant la recherche de la corresondance la plus proche
	sysLockScreen = TRUE
	
	--met le texte en antémémoire pour ne pas avoir ā rechercher la propriété si souvent.
	clear text of recordField "primerg1" of this page
	clear text of recordField "primer1" of this page
	string = my text
	
	--stocke la longueur de la chaîne courante
	stringLength = charCount(my text)
	
	--stocke le nombre d'éléments du champ dans lequel la recherche s'effectue
	numberItems = dimensions(itemArray)
	
	--s'il y a du texte dans le champ, effectue une recherche pour trouver la correspondance 
	--la plus proche
	if stringLength > 0
		-- s'il y a un seul caractčre dans le champ, effectue une recherche binaire pour aller
		-- au début du groupe alphabétique de cette lettre
		if stringLength = 1

			get binarySearch(string)

			--sélectionne la ligne de texte trouvée et fait défiler le champ pour l'atteindre
			set selectedTextlines of field "index" to it
			set scroll of field "index" to it - 1

		--il y a plusieurs caractčres dans ce champ, donc commence la recherche séquentielle
		-- pour trouver la correspondance la plus proche
		else

			--commence ā la ligne actuellement sélectionnée qui est l'ancienne 					--correspondance la plus proche
			itemNumber = selectedTextlines of field "index"

			conditions
				
			--lorsque les premiers n caractčres de l'élément de la matrice sont inférieurs ā la 			--chaîne courante, il faut effectuer une recherche séquentielle vers le bas dans
			-- la matrice jusqu'ā ce que l'élément suivant soit supérieur ou égal ā la chaîne
			-- courante ou jusqu'ā atteindre la fin de la matrice
			when chars 1 to stringLength of itemArray[itemNumber] < string as text
				while chars 1 to stringLength of itemArray[itemNumber + 1] < string as text and \
				      itemNumber <= numberItems
					increment itemNumber
				end
				
				-- si l'on arręte la recherche parce que les chaînes sont égales, le
				-- nombre d'éléments devrait ętre incrémenté pour que la ligne égale,
				-- et non pas celle au-dessus, soit mise en surbrillance.
				if chars 1 to stringLength of itemArray[itemNumber + 1] = string as text
					increment itemNumber
				end
				
			-- lorsque les premiers n caractčres de l'élément de la matrice sont supérieurs 				-- ou égaux ā la chaîne courante, il faut effectuer une recherche séquentielle
			-- vers le haut dans la matrice jusqu'ā ce que l'élément suivant soit le premier
			-- dans la matrice ou soit l'élément < de matrice.
			when chars 1 to stringLength of itemArray[itemNumber] >= string as text
				while itemNumber > 1 and \
				  chars 1 to stringLength of itemArray[itemNumber - 1] >= string as text    
					decrement itemNumber
				end				
			end conditions
			
			--sélectionne la ligne de texte avec la correspondance la plus proche
			-- et la fait défiler
			set selectedTextlines of field "index" to itemNumber
			set scroll of field "index" to itemNumber - 1
		end if
	else
		--s'il n'y a pas de texte dans le champ, sélectionne la premičre ligne de texte
		--et la fait défiler vers le haut du champ
		set selectedTextlines of field "index" to 1
		set scroll of field "index" to 0
	end if
	sysLockScreen = FALSE
end keyChar

to get binarySearch string
	system ARRAY STRING itemArray[]
	
	--initialise les limites supérieures et inférieures et le point de départ de la recherche
	upper = dimensions (itemArray)
	lower = 1
	currentPosition = (lower + upper)  DIV 2
	
	found = FALSE
	
	-- diminue l'ampleur de la recherche jusqu'ā la découverte d'une correspondance ou jusqu'ā ce
	-- qu'il n'y a plus d'éléments ā rechercher
	while not found and (upper >= lower)
		conditions
		-- lorsque la chaîne est inférieure ā l'élément de la matrice, les éléments situés 				-- au-dessus de l'élément de la matrice sont éliminés et la recherche s'effectue				-- sur la moitié inférieure
		when string < char 1 of itemArray[currentPosition] as text
			upper = currentPosition - 1
			currentPosition = (lower + upper) DIV 2
			
		-- lorsque la chaîne est supérieure ā l'élément de la matrice, les éléments situés 
		--au-dessous de l'élément de la matrice sont éliminés et la recherche s'effectue
		-- sur la moitié supérieure
		when string > char 1 of itemArray[currentPosition] as text
			lower = currentPosition + 1
			currentPosition = (lower + upper) DIV 2
		else
		--soit nous avons une correspondance, soit la chaîne ne se trouve pas dans la matrice
			found = TRUE
		end conditions
	end while

	--si la recherche est arrętée parce que la correspondance exacte n'est pas trouvée, il faut
	--vérifier s'il est nécessaire d'aller d'un élément plus loin car l'élément aprčs lequel
	--la chaîne devrait aller est sélectionné dans la chaîne sans correspondance.
	if not found and string > char 1 of itemArray[currentPosition] as text
		increment currentPosition
	end if

	--nous devons nous assurer de sélectionner le premier élément qui correspond ā la chaîne,
	--ainsi, lorsqu'une correspondance est trouvée, il faut se déplacer vers le haut de la matrice
	--pour trouver l'élément.
	while currentPosition > 1 and string = char 1 of itemArray[currentPosition - 1] as text
		decrement currentPosition
	end while
	
	return currentPosition
end binarySearch
235 objects with script, 12862 script lines