Dear Koen,

thank you for your reply, but it does not work. It works only, if I call
the setWidth() method of WScrollArea. See the code below.

Regards,
Gabor



class MyPaintedWidget : public WPaintedWidget {

        public:
                MyPaintedWidget( WContainerWidget *parent = 0 ) :
WPaintedWidget(parent) {
                        w=2000;
                        h=100;
                        resize(w,h);
                }


        protected:
                void paintEvent(WPaintDevice *paintDevice) {
                        WPainter painter(paintDevice);
                        painter.fillRect(0,0,w,h,WBrush(white));
                        painter.drawLine(0,0,w,h);
                }

        private:
                double w,h;

};


class MyApplication : public WApplication {
        public:

                MyApplication(const WEnvironment& environment) :
WApplication(environment) {

                        WContainerWidget *w = new WContainerWidget();
                        w->setLayout( new WHBoxLayout() );
                        WScrollArea *a = new WScrollArea();
                        a->setWidth(WLength("500px"));
                        MyPaintedWidget *p = new MyPaintedWidget();
                        a->setWidget( p );
                        w->layout()->addWidget( a );
                        root()->addWidget( w );

                }
};

On Tue, 2011-06-21 at 17:11 +0200, Koen Deforche wrote:
> Hey,
> 
> 2011/6/21 tusi <[email protected]>:
> > Hi All,
> >
> > I would like to draw something on WPaintedWidget, which size is larger
> > than the client (browser) size. Therefore, I put it into a WScrollArea,
> > but I could not set the width of the scroll area correctly, e.g. to the
> > width of the client, because using "100%" sets the width of the scroll
> > area as large as is the width of the inner WPaintedWidget and not the
> > size of the client width. How can I set the width of a WScrollArea
> > exactly the same as the width of the client?
> 
> That is what a layout manager will do for you: put the WScrollArea in
> a layout manager (e.g. WVBoxLayout).
> 
> Regards,
> koen
> 
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest



------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to