May 06, 2024, 04:22:17 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Problem scrolling window in window

Started by LarryMc, March 22, 2008, 08:57:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

I need to have a resizeable parent window with a resizeable child window.
The child can be much larger than the parent.
I need the parent to scroll to see all the child.

Attached is code I modified from just being fixed ize parent w/ VScroll with fixed size child
to V&H scroll resizeable parent with resizeable child.

Problem is when I use parent scroll bars the child gets smaller until it looks minimized.


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

Yer using GetClientSize, which only returns the size of the client area of the window, and then SetSize, which effects the entire size of the window.

Try this:


sub reshow
def ax,ay,cx,cy:int
def tl,t2:int
   tl=getscrollpos(w,-2)
   t2=getscrollpos(w,-1)
   getsize w1,ax,ay,cx,cy
   'setsize w1,-t2,-tl,cx,800
   setsize w1,-t2,-tl,cx,cy
   return
endsub
Ionic Wind Support Team

LarryMc

Works much better. 
Another DUH! on me.
Nothing new.

Thanks

BTW, you never responded to my very last PM.  Figure you thought you had already read it since I sent you 2 so close together.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Still have a problem with resizing one window inside another.

2nd window displays at only half the size it was created as.

Larry

autodefine "Off"
CONST SB_CTL = 2
CONST SB_HORZ = 0
CONST SB_VERT = 1
CONST SIF_DISABLENOSCROLL = 0x8
CONST SIF_PAGE = 0x2
CONST SIF_POS = 0x4
CONST SIF_RANGE = 0x1
CONST SIF_TRACKPOS = 0x10
CONST SIF_ALL = (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)

TYPE SCROLLINFO
    UINT cbSize
    UINT fMask
    int  nMin
    int  nMax
    UINT nPage
    int  nPos
    int  nTrackPos
ENDTYPE

DECLARE IMPORT,SetScrollInfo(hwnd as UINT,id as INT,sinfo as SCROLLINFO,bRedraw as INT),INT
DECLARE IMPORT,GetScrollInfo(hwnd as UINT,id as INT,sinfo as SCROLLINFO),INT

def PageSizeH,PageSizeV:int
def w:window
def w1:window
def cwinheight:int
def cwinwidth:int
def cx,cy,ax,ay:int

openwindow w,0,0,500,500,@vscroll|@hscroll|@maxbox|@minbox|@size,0,"hello",&whnd
'openwindow w,0,0,500,200,@vscroll|@hscroll|@noautodraw|@maxbox|@minbox|@size,0,"hello",&whnd

'openwindow w1,0,0,cx,700,@nocaption,w,"",&subwindow
openwindow w1,0,0,1400,1400,@size,w,"",&subwindow
SETWINDOWCOLOR w1, RGB(255,0,0)
control w1,@button,"Test",10,600,70,22,0,10
cwinheight=1400
cwinwidth=1400
AdjustScrollV()
AdjustScrollH()
move w1,0,0
print w1,"Top"
move w1,0,670
print w1,"Bottom"
move w1,1000,1000
print w1,"."

waituntil w.hwnd=0
end
'--------------------------------------------------------------------------
sub whnd
def Moved:int
   select @class
      case @idclosewindow
         closewindow w
      case @idsize
         if w.hwnd
            AdjustScrollV()
            AdjustScrollH()
         endif
      case @idvscroll
         Moved=True
         select @code
            case @sbthumbtrack
               Setscrollpos(w,-2,@qual)
            case @sblinedown
               Setscrollpos(w,-2,getscrollpos(w,-2)+1)
            case @sblineup
               Setscrollpos(w,-2,getscrollpos(w,-2)-1)
            case @sbpagedown
               Setscrollpos(w,-2,getscrollpos(w,-2)+PageSizeV)
            case @sbpageup
               Setscrollpos(w,-2,getscrollpos(w,-2)-PageSizeV)
            default
               Moved=False
         endselect
         if Moved then Reshow()
      case @idhscroll
         Moved=True
         select @code
            case @sbthumbtrack
               Setscrollpos(w,-1,@qual)
            case @sblinedown
               Setscrollpos(w,-1,getscrollpos(w,-1)+1)
            case @sblineup
               Setscrollpos(w,-1,getscrollpos(w,-1)-1)
            case @sbpagedown
               Setscrollpos(w,-1,getscrollpos(w,-1)+PageSizeH)
            case @sbpageup
               Setscrollpos(w,-1,getscrollpos(w,-1)-PageSizeH)
            default
               Moved=False
         endselect
         if Moved then Reshow()
      case @idpaint
         reshow()
   
   endselect
   return
endsub
sub AdjustScrollV()
def si:SCROLLINFO
def cx,cy,ax,ay:int
   getclientsize w,ax,ay,cx,cy
   si.cbSize=len(si)
   si.nMin=0
   si.nMax=cwinheight-1
   si.nPage=cy
   si.fMask=SIF_RANGE|SIF_PAGE
   SetScrollInfo(w.hwnd,SB_VERT,si,1)
   PageSizeV=cy
   return
endsub
sub AdjustScrollH()
def si:SCROLLINFO
def cx,cy,ax,ay:int
   getclientsize w,ax,ay,cx,cy
   si.cbSize=len(si)
   si.nMin=0
   si.nMax=cwinwidth-1
   si.nPage=cx
   si.fMask=SIF_RANGE|SIF_PAGE
   SetScrollInfo(w.hwnd,SB_HORZ,si,1)
   PageSizeH=cx
   return
endsub
'------------------------------------------------------------------------
sub subwindow
  select @class
      case @idclosewindow
         closewindow w1
      case @idsize
            AdjustScrollV()
            AdjustScrollH()
getsize w1,ax,ay,cx,cy
SETCAPTION w, str$(ax)+str$(ay)+str$(cx)+str$(cy)

endselect
   return
endsub
'------------------------------------------------------------------------
sub reshow
def ax,ay,cx,cy:int
def tl,t2:int
   tl=getscrollpos(w,-2)
   t2=getscrollpos(w,-1)
   getsize w1,ax,ay,cx,cy
   setsize w1,-t2,-tl,cx,cy
   return
endsub
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

No time to compile it at the moment.   However I must point out that an autodrawn window (window created normally without the @NOAUTODRAW style) can only be as big as your system screen size.  Anything drawn outside of those boundries won't appear, or at least won't persist.

If you are creating a window larger than the current screen size you have to use the @NOAUTODRAW style and do all of your drawing in response to @IDPAINT

Paul.
Ionic Wind Support Team

LarryMc

Thanks

I had increased my screen size(resolution) and got it to make a window a little bigger so I was suspecting what you described.

Thanks for confirming and for the additional clarification. 

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library