|
From: Alain A. <ala...@wa...> - 2015-03-30 17:12:02
|
Le 29. 03. 15 17:00, Alain Aupeix a écrit :
> I just need to improve to allow more than one parameter, and embedded
> menus
I have modified my first test, to generate menus and submenus.
When developping the menu structure, it works except when there the menu
command is MENUITEM (at the end of the creation)
Action doesn't work as expected.
The parameters are always the one of the last record.
I had first the problem using directly the fields in the process.
I replaced by an array and it's the same problem.
Here is the code:
local aDepart:={}, aMenus:={}, cDept, nbdep, nbcom, nbmenu, rgd, rgc,
action, param1, param2, cCanton, cArrondissement, nDept, nTab:=0
// Prérequis des Menus
select 2
use communes index decaco
nbcom=lastrec()
go top
select 3
use departments index depart
go top
nbdep=lastrec()
go top
for rgd=1 to nbdep
select 3
aadd(aDepart,{departments->deparmnt,departments->code})
select 2
rgd=1
do while trim(communes->deparmnt) == trim(departments->deparmnt)
aadd(aCommune,{communes->insee,communes->postal,communes->commune,communes->canton,communes->arondmnt,communes->deparmnt,communes->immatric,communes->latitude,communes->longitude,communes->indice,rgd})
rgd++
skip
enddo
next
select 3
nbdep=lastrec()
// Menus
MENU OF oMainWindow
MENU TITLE "&Fichier"
MENUITEM "&Ouvrir" ACTION FileOpen()
SEPARATOR
MENUITEM "Configuration" ACTION IniEdit()
SEPARATOR
MENUITEM "&Quitter" ACTION Quitter()
ENDMENU
MENU TITLE "&Outils"
MENUITEM "&Lire un registre (local)" ACTION ReadReg()
MENU TITLE "Archives départementales"
for rgd = 1 to nbdep
cDept = aDepart[rgd,1]
nDept = aDepart[rgd,2]
MENU TITLE trim(cDept)
MENU TITLE "Accéder aux communes"
rgc=1
do while trim(aCommune[rgc,6]) == trim(cDept)
cArrondissement = aCommune[rgc,5]
cCanton = aCommune[rgc,4]
MENU TITLE trim(cArrondissement)
do while aCommune[rgc,5] == cArrondissement
cCanton = aCommune[rgc,4]
MENU TITLE trim(cCanton)
do while aCommune[rgc,4] == cCanton
action="canton24"
param1=trim(aCommune[rgc,4])
param2=trim(aCommune[rgc,10])
cCommune = trim(aCommune[rgc,3])
// this qout confirms that the values are correct during the construct
process
qout(cCommune+space(40-len(cCommune))+action+"("+param1+","+param2+")")
MENUITEM cCommune ACTION
&(action)('"'+param1+'"','"'+param2+'"')
rgc++
if rgc > nbcom
exit
endif
enddo
ENDMENU
rgc++
if rgc > nbcom
exit
endif
enddo
ENDMENU
rgc++
if rgc > nbcom
exit
endif
enddo
ENDMENU
SEPARATOR
MENUITEM "&Télécharger un BMS" ACTION Commune("bms")
MENUITEM "Télécharger une &décénale" ACTION Commune("dec")
ENDMENU
next
ENDMENU
...
ENDMENU
I really don't understand what is the problem.
If you have an idea ...
Thanks
A+
--
------------------------------------------------------------------------
Alain Aupeix
http://jujuland.pagesperso-orange.fr/
http://pissobi-lacassagne.pagesperso-orange.fr/
------------------------------------------------------------------------
U.buntu 12.04 | G.ramps 3.4.8-1 | H.arbour 3.2.0dev (2015-03-27 15:21) |
HbIDE (Rev.316) | Five.Linux (r138) | Hw.Gui (2375)
------------------------------------------------------------------------
|