Hey Frans,

2009/2/18 Frans Meulenbroeks <[email protected]>:
> Hi,
>
> Sorry if I am asking too  much n00b questions. I'm still in the learning mode.
>
> I want to control the positioning of a widget. To test that I made an
> application with only the following code:
>
>  WAnchor *wan = new WAnchor("aa", "tst", root());
>  wan->setMargin(300, WWidget::Top);
>
> However, the setMargin does not work, the anchor still shows up at the top.
> But if I use Left then the setMargin call works.
>
> Guess I am overlooking something obvious, but what?

The wonderful(?!) rules of CSS...

I am not a CSS expert (despite having meddled in it for a long time
already), but CSS makes a big distinction between inline content
(text, anchors, images, buttons, ...) and block-level content (divs,
paragraphs, ...). Block-level contents can be manipulated better than
inline content with respect to positioning. Still there are many rules
about collapsing margins (which might plague you right now?).

wan->setInline(false);

You will find out that the easiest way to deal with the whole CSS
insanity is to not try to program it (using the Wt API) but use an
external stylesheet together with a lot of trial and error.

The fastest trial and error is changing the styles with firebug, a
plugin for firefox. But do not forget to ceck how IE handles it...

 >PS: one more Q: is it possible to find out the size of the browser area.
> What I actually want is to control the position. (e.g. if I have 4
> buttons or anchors, I would like to have them as
> A B
> C D
> centered in the screen.
>
> Suggestions on how to do this are welcome! Frans.

I have seen tricks, similar to how WDialog achieves this, on the
Internet. The WDialog situation is a bit more complicated since it
also needs to cover the other contents with a semi-opaque div. The
solution had a different approach in compliant browsers than IE, but
did not require any JavaScript (and thus no absolute dimensions). I'll
see if I can dig it up again.

Regards,
koen

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to