I finally figured it all out and am putting a working example On the board for setting up a the equivalent of an LB GraphicBox Converted to CB Example. I don't know if this is the best place to put this . So, moderators if I am incorrect just drop me an note. If you need to move this please feel free of coarse. I am just happy!!! to have a solutions. Thanks to everyone for their help!
Thanks Texas Pete
'-----------------------Some minor changes may still need to be done-------------------
declare "user32",SetWindowPos(Hwnd:int,HwndAfter:int,x:int,y:int,cx:int,cy:int,flags:int)
setid "SWP_NOMOVE",2
setid "SWP_NOSIZE",1
setid "HWND_TOPMOST",-1
setid "HWND_NOTOPMOST",-2
'TexasPete Scroll---------------------
def win1:window
def win2:window
def wMain1:window
'def GraphicBox:window
def wstyle1:int
DEF wstyle2:int
def ScreenWidth:int
def ScreenHeight:int
def x,y,w,h:int
def x2,y2,w2,h2:int
def a$,newline:string
def handle:int
def CursorHandle:int
def MinScroll:int
Def MaxScroll:int
Def VertScroll:int
def HorzScroll:int
def PositionScroll:int
def Mainstyle:int
def MainWidth:int
def MainHeight:int
VertScrol=-2
HorzScrol=-1
'add to win2 + 600 pixels
h2=600
w2=600
wstyle1 = @VSCROLL|@HSCROLL|@NOCAPTION
wstyle2 = @NOCAPTION
Mainstyle=@MINBOX|@MAXBOX|@SIZE
'----Get the size of the screen---------------------
' i'm curently using 800x600
GETSCREENSIZE ScreenWidth,ScreenHeight
MainWidth=ScreenWidth
MainHeight=ScreenHeight
'-----------------------------------------------
Window wMain1,0,0,MainWidth,MainHeight,Mainstyle,0,"Main Window Basic",main1
'Set Window Height and Width in main window create
'Main Window - parent
ScreenWidth=ScreenWidth-200:ScreenHeight=ScreenHeight-200
'----------------------------------------------------------------------
Window win1,100,100,ScreenWidth,ScreenHeight,wstyle1,wMain1,"Main Scrolling Window",main1
SETWINDOWCOLOR win1,rgb(0,0,40)
'----second window child -----------
Window win2,0,0,ScreenWidth,ScreenHeight,wstyle2,win1,"Child Window ",main1
SETWINDOWCOLOR win2,rgb(190,200,240)
'--------Set the scroll ranges---------------------
SETSCROLLRANGE win1,-2,1,600
SETSCROLLRANGE win1,-1,1,600
'SetWindowPos(wMain1,@HWND_TOPMOST,0,0,0,0,@SWP_NOMOVE|@SWP_NOSIZE) )
Rect win2,99,29,402,302,rgb(0,150,150)
Move win2,100,100:Print win2,"A Simple"
Move win2,100,130:Print win2,"Creative Window"
Move win2,10,550:Print win2,"This text is visible after you move Vscrollbar"
Circle win2,400,550,100
'------------------------
Waituntil win1 = 0
END
'--------------------
SUB main1
SELECT @CLASS
CASE @IDVSCROLL : ' Vertical Scrollbar @message
SELECT @CODE
CASE @SBLINEUP
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))-10
CASE @SBLINEDOWN
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))+10
CASE @SBPAGEUP
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))-50
CASE @SBPAGEDOWN
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))+50
CASE @SBTHUMBPOS
SETSCROLLPOS win1,-2, @QUAL
CASE @SBTHUMBTRACK
SETSCROLLPOS win1,-2, @QUAL
ENDSELECT
SetSize win2,0,-GETSCROLLPOS(win1,-2),ScreenWidth,ScreenHeight+h2
'----------------------------------------------------------------
CASE @IDHSCROLL
SELECT @CODE
CASE @SBLINELEFT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))-10
CASE @SBLINERIGHT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))+10
CASE @SBPAGELEFT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))-50
CASE @SBPAGERIGHT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))+50
CASE @SBTHUMBPOS
SETSCROLLPOS win1,-1, @QUAL
CASE @SBTHUMBTRACK
SETSCROLLPOS win1,-1, @QUAL
ENDSELECT
SetSize win2,-GETSCROLLPOS(win1,-1),0,ScreenWidth+w2,ScreenHeight
'----------------------------
Case @idclosewindow
'becose we have win2 as child win in main1 win2 is closed automaticly
Closewindow wMain1
Closewindow win1
ENDSELECT
RETURN
SUB main2
IF @CLASS = @IDCLOSEWINDOW
REM closes the window and sets w1 = 0
CLOSEWINDOW win1
ENDIF
RETURN
"-------------The End Texas Pete 7/29/09
I see one problem - why your scrolling have blinking?
You're still not checking the scrollbar position of BOTH scrollbars when you are setting the position of the window (lines 96 and 119). You are also changing the window size when the user scrolls to different sizes depending on which scrollbar the user uses. The window size should stay the same.
It should be something like :
SetSize win2,-GETSCROLLPOS(win1,-1),-GETSCROLLPOS(win1,-2),ScreenWidth,ScreenHeight
Thanks Zero Dog,
I will looking into it .
Texas Pete
ZeroDog , Here is I believe a correct working example. One of the things that was confusing me is the manual.
The Manual looks just like this:
SETSIZE dialog|window,L,T,W,H,ID
It made me think that the control Id went on the end? Also if you count each unit there are 6 positions counting the window handle and not 5. I know I may be trying some peoples patience. But stuff Like this is confusing when your trying to become familiar with th syntax. . W, H, Id I was able to figure out, I still am looking at the page to try to find exactly what L and T stand for. Anyway, I hope this post helps someone in the future.
Thanks for your help Aurel and ZERO DOG,
IF SOMEONE WANT TO CHECK IT FOR FURTHER ERRORS. I would appreciate it. I made a lot of progress yesterday in my translation efforts. I am starting to get a little feel for the languge.
Texas Pete Ye! Ha!
'-----------------------Some minor changes may still need to be done-------------------
declare "user32",SetWindowPos(Hwnd:int,HwndAfter:int,x:int,y:int,cx:int,cy:int,flags:int)
setid "SWP_NOMOVE",2
setid "SWP_NOSIZE",1
setid "HWND_TOPMOST",-1
setid "HWND_NOTOPMOST",-2
'TexasPete Scroll---------------------
def win1:window
def win2:window
def wMain1:window
'def GraphicBox:window
def wstyle1:int
DEF wstyle2:int
def ScreenWidth:int
def ScreenHeight:int
def x,y,w,h:int
def x2,y2,w2,h2:int
def a$,newline:string
def handle:int
def CursorHandle:int
def MinScroll:int
Def MaxScroll:int
Def VertScroll:int
def HorzScroll:int
def PositionScroll:int
def Mainstyle:int
def MainWidth:int
def MainHeight:int
VertScrol=-2
HorzScrol=-1
'add to win2 + 600 pixels
h2=600
w2=600
wstyle1 = @VSCROLL|@HSCROLL|@NOCAPTION
wstyle2 = @NOCAPTION
Mainstyle=@MINBOX|@MAXBOX|@SIZE
'----Get the size of the screen---------------------
' i'm curently using 800x600
GETSCREENSIZE ScreenWidth,ScreenHeight
MainWidth=ScreenWidth
MainHeight=ScreenHeight
'-----------------------------------------------
Window wMain1,0,0,MainWidth,MainHeight,Mainstyle,0,"Main Window Basic",main1
'Set Window Height and Width in main window create
'Main Window - parent
ScreenWidth=ScreenWidth-200:ScreenHeight=ScreenHeight-200
'----------------------------------------------------------------------
Window win1,100,100,ScreenWidth,ScreenHeight,wstyle1,wMain1,"Main Scrolling Window",main1
SETWINDOWCOLOR win1,rgb(0,0,40)
'----second window child -----------
Window win2,0,0,ScreenWidth,ScreenHeight,wstyle2,win1,"Child Window ",main1
SETWINDOWCOLOR win2,rgb(190,200,240)
'--------Set the scroll ranges---------------------
SETSCROLLRANGE win1,-2,1,600
SETSCROLLRANGE win1,-1,1,600
'SetWindowPos(wMain1,@HWND_TOPMOST,0,0,0,0,@SWP_NOMOVE|@SWP_NOSIZE) )
Rect win2,99,29,402,302,rgb(0,150,150)
Move win2,100,100:Print win2,"A Simple"
Move win2,100,130:Print win2,"Creative Window"
Move win2,10,550:Print win2,"This text is visible after you move Vscrollbar"
Circle win2,400,550,100
'------------------------
Waituntil win1 = 0
END
'--------------------
SUB main1
SELECT @CLASS
CASE @IDVSCROLL : ' Vertical Scrollbar @message
SELECT @CODE
CASE @SBLINEUP
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))-10
CASE @SBLINEDOWN
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))+10
CASE @SBPAGEUP
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))-50
CASE @SBPAGEDOWN
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))+50
CASE @SBTHUMBPOS
SETSCROLLPOS win1,-2, @QUAL
CASE @SBTHUMBTRACK
SETSCROLLPOS win1,-2, @QUAL
ENDSELECT
SetSize win2,0,-GETSCROLLPOS(win1,-2),ScreenWidth,ScreenHeight+h2
'----------------------------------------------------------------
CASE @IDHSCROLL
SELECT @CODE
CASE @SBLINELEFT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))-10
CASE @SBLINERIGHT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))+10
CASE @SBPAGELEFT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))-50
CASE @SBPAGERIGHT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))+50
CASE @SBTHUMBPOS
SETSCROLLPOS win1,-1, @QUAL
CASE @SBTHUMBTRACK
SETSCROLLPOS win1,-1, @QUAL
ENDSELECT
SetSize win2,-GETSCROLLPOS(win1,-1),0,ScreenWidth+w2,ScreenHeight
'----------------------------
Case @idclosewindow
'becose we have win2 as child win in main1 win2 is closed automaticly
Closewindow wMain1
Closewindow win1
ENDSELECT
RETURN
SUB main2
IF @CLASS = @IDCLOSEWINDOW
REM closes the window and sets w1 = 0
CLOSEWINDOW win1
ENDIF
RETURN
"-------------The End Texas Pete 7/30/09
At a guess try Left and Top for the position on the screen of the Window.
No guessing to it. ;)
From the quick reference quide:
QuoteSETSIZE window | dialog, left, top, width, height {,ID}
Changes the size of a window, dialog, or control. If ID is specified then it must be a valid and visible control.
also from the help file:
QuoteSETSIZE dialog|window, L, T, W, H {,ID}
Will set the size and position of the window. The window will start at the point specified by the L(eft) and T(op) variables and the size will be set by the W(idth) and H(eight) variables. If ID is specified then the control with that ID is sized
Larry
Larry, I am cetainly confused. Using my example that appears to work. The conrol id is not at the end of the chain. I will look at my example again. I am always willing to learn.
SetSize win2,-GETSCROLLPOS(win1,-1),-GETSCROLLPOS(win1,-2),ScreenWidth,ScreenHeight
Larry, I looked at my code. This is above is what ZERO dog suggested and it appears to be working.
There is no control id at the end. When I was testing I tried to put a control ID at the end and I kept getting a syntax error. I know I was getting the control id and windows confused on several occasions. If it needs a control Id at the end Is there a reason it is working without one?
Texas Pete
Read the users guide Pete. The control id is optional as indicated by {,ID}
Under Microsoft Windows controls have numeric identifiers. A window doesn't have a numeric identifier. Which is why certain commands that work with both a window or a control have an optional ID parameter.
Also please use code tags when posting code on the forums. Click on the # button in the toolbar when you are posting and insert your code between the two.
Thanks,
Paul Turley
Youre still not checking both scrollbar positions when setting the window position with SetSize. You want something like this:
'-----------------------Some minor changes may still need to be done-------------------
declare "user32",SetWindowPos(Hwnd:int,HwndAfter:int,x:int,y:int,cx:int,cy:int,flags:int)
setid "SWP_NOMOVE",2
setid "SWP_NOSIZE",1
setid "HWND_TOPMOST",-1
setid "HWND_NOTOPMOST",-2
'TexasPete Scroll---------------------
def win1:window
def win2:window
def wMain1:window
'def GraphicBox:window
def wstyle1:int
DEF wstyle2:int
def ScreenWidth:int
def ScreenHeight:int
def x,y,w,h:int
def x2,y2,w2,h2:int
def a$,newline:string
def handle:int
def CursorHandle:int
def MinScroll:int
Def MaxScroll:int
Def VertScroll:int
def HorzScroll:int
def PositionScroll:int
def Mainstyle:int
def MainWidth:int
def MainHeight:int
def horizontalScrollbarPosition:int
def verticalScrollbarPosition:int
VertScrol=-2
HorzScrol=-1
'add to win2 + 600 pixels
h2=600
w2=600
wstyle1 = @VSCROLL|@HSCROLL|@NOCAPTION
wstyle2 = @NOCAPTION
Mainstyle=@MINBOX|@MAXBOX|@SIZE
'----Get the size of the screen---------------------
' i'm curently using 800x600
GETSCREENSIZE ScreenWidth,ScreenHeight
MainWidth=ScreenWidth
MainHeight=ScreenHeight
'-----------------------------------------------
Window wMain1,0,0,MainWidth,MainHeight,Mainstyle,0,"Main Window Basic",main1
'Set Window Height and Width in main window create
'Main Window - parent
w2=ScreenWidth-200:h2=ScreenHeight-200
'----------------------------------------------------------------------
Window win1,100,100,w2,h2,wstyle1,wMain1,"Main Scrolling Window",main1
SETWINDOWCOLOR win1,rgb(0,0,40)
'----second window child -----------
Window win2,0,0,screenwidth,screenheight,wstyle2,win1,"Child Window ",main1
SETWINDOWCOLOR win2,rgb(190,200,240)
'--------Set the scroll ranges---------------------
SETSCROLLRANGE win1,-2,1,screenheight-h2
SETSCROLLRANGE win1,-1,1,screenwidth-w2
'SetWindowPos(wMain1,@HWND_TOPMOST,0,0,0,0,@SWP_NOMOVE|@SWP_NOSIZE) )
Rect win2,99,29,402,302,rgb(0,150,150)
Move win2,100,100:Print win2,"A Simple"
Move win2,100,130:Print win2,"Creative Window"
Move win2,10,550:Print win2,"This text is visible after you move Vscrollbar"
Circle win2,400,550,100
'------------------------
Waituntil win1 = 0
END
'--------------------
SUB main1
SELECT @CLASS
CASE @IDVSCROLL : ' Vertical Scrollbar @message
SELECT @CODE
CASE @SBLINEUP
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))-10
CASE @SBLINEDOWN
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))+10
CASE @SBPAGEUP
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))-50
CASE @SBPAGEDOWN
SETSCROLLPOS win1,-2, (GETSCROLLPOS(win1,-2))+50
CASE @SBTHUMBPOS
SETSCROLLPOS win1,-2, @QUAL
CASE @SBTHUMBTRACK
SETSCROLLPOS win1,-2, @QUAL
ENDSELECT
horizontalScrollbarPosition=GETSCROLLPOS(win1,-1)
verticalScrollbarPosition=GETSCROLLPOS(win1,-2)
SetSize win2,-horizontalScrollbarPosition,-verticalScrollbarPosition,screenwidth,screenheight
'----------------------------------------------------------------
CASE @IDHSCROLL
SELECT @CODE
CASE @SBLINELEFT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))-10
CASE @SBLINERIGHT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))+10
CASE @SBPAGELEFT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))-50
CASE @SBPAGERIGHT
SETSCROLLPOS win1,-1, (GETSCROLLPOS(win1,-1))+50
CASE @SBTHUMBPOS
SETSCROLLPOS win1,-1, @QUAL
CASE @SBTHUMBTRACK
SETSCROLLPOS win1,-1, @QUAL
ENDSELECT
horizontalScrollbarPosition=GETSCROLLPOS(win1,-1)
verticalScrollbarPosition=GETSCROLLPOS(win1,-2)
SetSize win2,-horizontalScrollbarPosition,-verticalScrollbarPosition,screenwidth,screenheight
'----------------------------
Case @idclosewindow
'becose we have win2 as child win in main1 win2 is closed automaticly
Closewindow wMain1
Closewindow win1
ENDSELECT
RETURN
SUB main2
IF @CLASS = @IDCLOSEWINDOW
REM closes the window and sets w1 = 0
CLOSEWINDOW win1
ENDIF
RETURN
'-------------The End Texas Pete 7/30/09
ZeroDog,
I see the change and I thought about doing that!
horizontalScrollbarPosition=GETSCROLLPOS(win1,-1)
verticalScrollbarPosition=GETSCROLLPOS(win1,-2)
But this is what I thought. I thought that putting :
"GETSCROLLPOS(win1,-1)" or " GETSCROLLPOS(win1,-2)" in the correct place in "SetSize" was the same thing.
Please help me to understand. Is is required to assign the GetScrollPos to a separate vairable? A lot of the stuff and syntax is starting to sink in. I just about have my skeleton done for the first page for my conversion from LB to CB.
Thanks Texas Pete
I see my karma rating is about as low as it can go. So to those who have smitten me God Bless You all.
QuoteIs is required to assign the GetScrollPos to a separate vairable?
No, not at all, I was just trying to make it easier for you to see. What you were doing was positioning the window based on ONE scrollbar position. You need to position the window based on BOTH scrollbar positions. And the window size generally should stay the same. You were adding w2 or h2 to the width/height of the window depending on the scrollbar that was accessed. You usually dont need to change the size of the window.
Hope this clears it up a bit :)
QuoteYou usually dont need to change the size of the window.
Now I dont understand anythinng.
This thematic is little bit confusing.
And how solve problem with flickering?
heh. When I said "You usually dont need to change the size of the window. " I was actually referring to the dimensions of the window. You still need to use the SetSize function to position the window, but you change the left and top variables of the window, and the width and height stay the same. Sorry for the confusion :)
I notice a small flicker when the window is scrolled, but this is just the repaint of the screen. It may be more noticeable on slower or busier systems. Im not sure if this is the flicker that you mean...