« Return to Thread: fxscrollwindow

Re: fxscrollwindow

by n d-3 :: Rate this Message:

Reply to Author | View in Thread

It seems that setPosition actually is working, but the function that updates the position of the scrollbar is being called art the wrong time. the idea is that it is continuously called, so for FXMAPFUNC i used the message type as SEL_UPDATE. However, it seems the widget is only updated when the mouse moves over it in an up or down fashion. Any reason why this might happen? I will also provide code if that is at all helpful. Also, how does one tell when the scroller has reached the end of the scrollbar?

Here is the widget I am trying to make:


class newWidget: public FXHorizontalFrame
{
  FXDECLARE(newWidget)

  protected:
    newWidget(){}
    FXLabel* label;
    FXScrollWindow* scroll;
    FXString text;
   
    FXString adjustText(FXString labelText)
    {
      // this might need work later on
      double w = scroll->getWidth();
      w *= 1.5;
     
      for(int l = 0; l < (w/2); l++)
      {
        if(l < (w/4))
        {
          labelText.prepend(" ");
         
        }
        else
        {
          labelText.append(" ");
        }
      }
      return labelText;
    }
   
  public:
   
    newWidget(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0, FXString labelText="", FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_SPACING,FXint pr=DEFAULT_SPACING,FXint pt=DEFAULT_SPACING,FXint pb=DEFAULT_SPACING,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING):
        FXHorizontalFrame(p,opts,x,y,w,h,pl,pr,pt,pb,hs,vs)
    {
      scroll = new FXScrollWindow(this,opts|VSCROLLING_OFF|HSCROLLER_NEVER,x,y,w,h);
      label = new FXLabel(scroll,adjustText(labelText),0,opts,x,y,w,h,pl,pr,pt,pb);
      text = labelText;
      target = tgt;
      message = sel;
    }
     
      void setText(FXString labelText)
      {
      label->setText(adjustText(labelText));
      text = labelText;
    }
   
    void UpdText()
    {
      label->setText(adjustText(text));
    }
   
    void UpdPosition()
    {
      // need this to test if end of scrollbar is reached
      if(1 == 1)
      {
        int x = scroll->getXPosition();
        scroll->setPosition(x-2, 0);
      }
      else
      {
        scroll->setPosition(0, 0);
      }
    }
};


2009/6/3 Jeroen van der Zijp <jeroen@...>
On Tuesday 02 June 2009, n d wrote:
> Hi again everyone. Quick question about FXScrollWindow: is it just me, or
> does the setPosition() function not work? whenever i call the call the
> function the scroll bar never moves. Any suggestions as to why this is
> happening?

It may be due to the following causes:

       1) FXScrollWindow's child (contentWindow) has a size which is smaller than
          the FXScrollWindow's viewport.  Obviously, in such a case it never needs
          scrolling.  Depending on the flags, scrollbars may or may not be visible.

       2) You've turned scrolling off.

       3) The contentWindow's layout hints are such (e.g. LAYOUT_FILL_X or LAYOUT_FILL_Y)
          that it will be placed to fill the viewport area.

       4) It does scroll, but has no change to repaint.


These are some of the things I can think off...


               - Jeroen



--
+----------------------------------------------------------------------------+
| Copyright (C) 23:30 06/ 2/2009 Jeroen van der Zijp.   All Rights Reserved. |
+----------------------------------------------------------------------------+


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Foxgui-users mailing list
Foxgui-users@...
https://lists.sourceforge.net/lists/listinfo/foxgui-users

 « Return to Thread: fxscrollwindow