günther
19th January 2005, 17:29
There have been some discussions on drawing, displaying gif images, adding list boxes and so on, all based on create.object(). The most popular way here is to code x- and y- positions to align with the other text layout.

But: Problems happen, if the user specifies a different font or character size, e.g. -- -set FONT="Verdana" -set FONTHEIGHT=10.

Any ideas to solve the problems in that case? Any predefined variables? Can the actual font size be retrieved?

mark_h
19th January 2005, 18:13
Looks like from your profile you are using unix, so the set commands should set environment variables. I think you can retrieve these using getenv$ to retrieve how they are set. Maybe from that it will help you determine what to do with create.object.

Mark

günther
20th January 2005, 08:47
Okay so far. Problem 1 solved:

string env.font(30)
string env.h(30)
string env.w(30)

env.font = tolower$(getenv$("FONT"))
env.h = getenv$("FONTHEIGHT")
env.w = getenv$("FONTWIDTH")

But I have to code default values if nothing specified ...


Now Problem 2. I do it at the moment in the following way, but I would like it more generic.

long cp.x, cp.y

cp.x = <Column of a Text Field> * <Width> + <X Offset>
cp.y = (<Row of a Text Field> + actual.occ-1) * <Height> + <Y Offset>

Column and Row are Text Coordinates (i.e. Column = 1..80, Row = 1..25). Width and Height come from Problem 1.

Btw.: I discovered, that I have to introduce that magic <X Offset> and <Y Offset> values to make them really fit. Seems to come from the "inner" layout, the tool bar and so on.

So: Are ther any other variables to determine it instead of doing such calculations and assumptions?

Günther

mark_h
20th January 2005, 20:20
I guess I do not understand - Are you like drawing 25 rows? And each row has a certain number of fields(varying length)? I guess I am trying to figure out what the x and y offsets represent. Would any of the fattr predefined variables have useful stuff.

Mark

günther
21st January 2005, 12:11
Here is an example. The graphics positions on the right are calculated, not hard coded. You see the yellow and black rectangles.

mark_h
21st January 2005, 15:12
Would the fattr.height and fattr.width variables help with determining the offsets? I am not sure what happens to these fields when a user changes a font - I was just in debug mode on my test system and did not see where they were set. You may want to run the session in debug mode and use the "L" command(after form is up) to see what all is set. There are a lot of ttgfd table fields that may contain something to help you.

Mark

günther
12th May 2005, 13:05
I've been playing with ttgfd350 / ttgfd400 and so on. Is there any information out there?