473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Draw frames around some items

I have a file which contains component definitions, along with their
x/y coordinates and width and height. Examples for components are a
short text string, a text entry field, a date entry field, a
selection box, a checkbox.

The aim is to produce an HTML page that looks like those definitions
specify.

So I computed a grid which covers all the corners of all components
(actually only top left corners) and created an HTML table with
appropriate row heights and column widths. Into that table I
positioned all the elements and gave them the right width and height.

So far, so good.

Now, comes along a new kind of component, a frame. It has the usual
location and dimension attributes, plus some text, which is used as a
title, like so:

+-example frame--------+
| |
| |
| |
+----------------------+

I hope you can see the ascii graphics.

The idea behind the frame is that the frame frames all of the
components that are inside it.

(What happens when a component overlaps a frame border is
unspecified. They are drawn on top of each other, I guess. I'd
rather ignore this problem and pretend that all components will be
either fully inside a frame, or fully outside it.)

A logical implementation for this kind of frame would be the an HTML
table with a border. But this implementation doesn't fit the current
grid implementation too well. A way to deal with this is to do a
kind of a recursive layout, where I figure out which components are
inside the frame and then recursively call my table-building
algorithm for those.

Can you think of a clever HTML trick that would help me to avoid this?

For example, it might be possible to decompose the frame into the four
sides, and to consider each of them a separate component. Then I
could compute table rows and columns normally for the four sides. But
I'm afraid that the lines for the sides would then not join
correctly. (How to draw horizontal and vertical lines in HTML?)
Another approach might be to use absolute positioning with CSS. It
would lead to a simple algorithm, since the input is close to the
output. But if the browser doesn't grok absolute positioning, then
this approach will show nothing useful, whereas the table approach
might produce something that at least topologically looks like the
specification. Thus, I decided against the absolute positioning
approach. WDYT?

Kai
Jul 20 '05 #1
4 3583
Kai Grossjohann wrote:
I have a file which contains component definitions, along with their
x/y coordinates and width and height. Examples for components are a
short text string, a text entry field, a date entry field, a
selection box, a checkbox.


Is there a reason you can't use <fieldset> for that:
<fieldset>
<legend>Example Frame</legend>
<input type="text">
<select>
<option>Option 1</option>
</select>
<input type="checkbox">
</fieldset>

?
Jul 20 '05 #2
Keith Bowes <do****@spam.me> wrote:
Is there a reason you can't use <fieldset> for that:


Isn't it sufficient to state that there was no hint of any form being
involved? It would be very misleading to use form-related constructs
for something that isn't a form at all.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #3
"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message news:<Xn****************************@193.229.0.31> ...
Keith Bowes <do****@spam.me> wrote:
Is there a reason you can't use <fieldset> for that:


Isn't it sufficient to state that there was no hint of any form being
involved? It would be very misleading to use form-related constructs
for something that isn't a form at all.


I apologize. It is a form. I didn't think it was relevant to the
question, that's why I didn't state so in my original message.

Kai
Jul 20 '05 #4
Keith Bowes <do****@spam.me> wrote in message news:<1066254640.834784@cache3>...
Kai Grossjohann wrote:
I have a file which contains component definitions, along with their
x/y coordinates and width and height. Examples for components are a
short text string, a text entry field, a date entry field, a
selection box, a checkbox.


Is there a reason you can't use <fieldset> for that:


I didn't know that <fieldset> exists. Thanks for pointing this out.

Does this play well with my table layout? I think it would lead to
unbalanced start/end tags, if applied naively. But I am naive, so how
to apply it non-naively?

Let's say the original meta data specify four controls:

(1,1) - (20,5) text field A
(10,10)-(50,40) frame
(12,12)-(35,20) text field B
(55,10)-(65,15) text field C

As you can see, the frame frames text field B only. Thus, the HTML
code needs to look like this: the <fieldset> tag must come before the
text field B and the </fieldset> tag must come after text field B.

But my row/column algorithm will produce a table with 3 or 4 columns.
The first row contains text field A, the second row contains the frame
and also text field C, the third row contanis text field B.

So I get something like

....<tr>...<fieldset>...</tr>...
....<tr>...</fieldset>...</tr>...

which means unbalanced start/end tags.

Ideas?

(I hope you can understand what I mean; I fear that the above is not
explained very well.)

Kai
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave Smithz | last post by:
Hi there, I have implemented a login sequence using session variables for a PHP/MySQL DB which I took over development. I read some books and this NG and it seemed straight forward. However the...
13
by: elad | last post by:
Hi The Menu doesn't work properly when I have 2 frame and the Menu popup frame=document target frame, when I choose item in the menu the doc opened and the menu get stuck. Here is the code...
40
by: JohnnyCJohnny | last post by:
Is it pretty safe to say that almost all web surfers now use browsers that are Frames compatible? What are most people using these days? IE? Thanks
1
by: ruca | last post by:
Hi, I have a Web Application that have 3 frames. Top, Contents and Main are the 3 frames presents in App. My Top frame have only a image and a label, both represent application. My Contents...
1
by: Robin Tucker | last post by:
Hi ppl, My owner draw list box controls do not "refresh" old selected items when a new selection is made. This means that as you click to make selections, the previously selected items stay...
2
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
0
by: Adam Clauss | last post by:
I have a ListView in which I am attempting to get it to not draw the 'dotted' rectangle around items which are selected. All other drawing should be normal. I am using the listbox in SmallIcon...
1
by: nickyeng | last post by:
i have to design a simple game. I asked some question before in this forum. Now the game version is the new version with more items in it. now, i have a 11 items to draw, '$'. and i have a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.