How to retrieve a text string information



I have a GUI made up of a panel (buttons, entries, radiobuttons, menus,
etc..) and a canvas where the GUI user can have some scientific data
displayed in form of isocountour maps.
A new feature I've recently implemented allows for changing the canvas
aspect ratio, which is done by properly rescaling all the objects laid
on the canvas.
Once the lay-out is complete the user can place an arbitrary number of
text strings in arbitrary positions on the canvas. Since these text
strings are not part of the pool of graphic objects that are re-drawn
when the canvas is rescaled or the user browses back/forth among the
last 10 canvas lay-outs, the text strings do not rescale upon changing
the aspect ratio. They stay where they are.
So a special code branch must be developed to make these texts
rescalable and movable as the other graphic items.

My first idea was to limit the number of such text strings to, say, 10.

Then I would push onto a stack some information that identifies the
single text string and allows me to
manipulate it at a later time than its creation date. Upon changing the
canvas aspect ratio I would pop up the stack the text strings
information and apply the proper text coordinates rescaling.

My question sis: which information about the single text string shall I
save onto the stack in order to manipulate the text string later upon
request ?
I'd say the text string coordinates of its lower left corner (or any
other corner), the number of characters, the character font (which
tells me the character width and height), the text orientation,
the character string itself.... what else ?
Maybe I need fewer data ...? Or maybe I can just save the unique ID
that the Tcl interpreter assigns to each object. I guess such ID
identifies the object uniquely thus allows for retrieval of all its
data.
But do I have access to such an ID ? How ?
If I could just save the text IDs onto the stack then how should I
manipulate the text string coordinates through its ID ?

Thanks a lot for your help.
Maura

.


Quantcast