Hi Colin
What I wanted (and accomplished now) is the following:
I have two fields: the first is editable and I can write parameters and their
values in it, the other is locked and shows calculations based upon the
parameters available in the first field. To avoid typos I included a feature in
the first field that pops up a menu with the parameters needed for the
calculation. So, when I hit the return-key with the commandKey down, the menu
appears at the mousepointer and all the parameters that are already in the
field are disabled. If I choose a menuitem of that menu, the script has to
place the parameter after the line my cursor was; and that was the code I was
looking for.
Cheers
Thomas
The working scripts I use now:
First field:
--------------
on returnInField
if the commandKey is down then
--store the location of the cursor
set the C_Loc of me to word 2 of the selectedline
--populate the menu and disable/enable the menu items
Parameterliste
popup button "Parameter"
else
pass returnInField
end if
end returnInField
on Parameterliste
-- Auflisten der in den Berechnungen im Feld "Parameter-Menu" aufgelisteten
Parameter,
-- um sie bei der Eingabe im Feld Eigenschaften als PopUp-Menu
bereitzustellen.
-- Das PopUp-Menu wird angezeigt mit Befehl-Return ins dieses Feld
-- und bei dieser Gelegenheit auch abgeglichen.
put field "Parameter-Menu" into L_Liste
put L_Liste into button "Parameter"
put 1 into L_LineCount
repeat for each line x in L_Liste
if field "Eigenschaften" contains x then
disable menuitem L_LineCount of button "Parameter"
else
enable menuitem L_LineCount of button "Parameter"
end if
add 1 to L_LineCount
end repeat
end Parameterliste
PopUp-Button:
---------------------
on menuPick pItemName
-- look up the line the text should be placed
get the C_Loc of field "Eigenschaften"
-- place the name of the menu-item and add a colon and a tab
put return & pItemName & ":" & tab after line it of field "Eigenschaften"
select after line (it +1) of field "Eigenschaften"
end menuPick
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode