Ok, I admit I have had B+ for along time now but have yet to really do any GUI programming, but I'm hard and heavy into a program now and I keep having issues. The help section is very poor for the GUI and most commands don't have examples. I hope youcan help me along as I learn.
I was trying to implement sliders into my program and I came across a problem. I wrote this little code piece as simple as possible to show the problem.
win = CreateWindow("Test window",0,0,400,400)
can = CreateCanvas(0,0,400,400,win)
SetGadgetLayout can,1,0,1,0
hslider = CreateSlider(0,ClientHeight(win)-18,ClientWidth(win)-20,18,win)
vslider = CreateSlider(ClientWidth(win)-18,0,18,ClientHeight(win),win,2)
Repeat
Until KeyHit(1)
Now what I am having issues with is when the slider bar is over the canvas it wont operate, but resize the window so the bar is off the canvas and it does operate. You can see with 2 sliders you can have one on the canvas and one off the canvas.
Questions
1) Is this how sliders work, if not what am I missing.
2) If this is how sliders work, does it mean I have to resize the canvas so its area is inside of the sliders.
would it be something like this -
win = CreateWindow("Test window",0,0,400,400)
can = CreateCanvas(0,0,400,400,win)
SetGadgetLayout can,1,0,1,0
hslider = CreateSlider(0,ClientHeight(win)-18,ClientWidth(win)-20,18,win)
vslider = CreateSlider(ClientWidth(win)-18,0,18,ClientHeight(win),win,2)
Repeat
If WaitEvent() = $802 Then
SetGadgetShape can, 0,0,ClientWidth(win)-30,ClientHeight(win)-30
SetGadgetShape hslider, 0,ClientHeight(win)-18,ClientWidth(win)-20,18
SetGadgetShape vslider, ClientWidth(win)-18,0,18,ClientHeight(win)
EndIf
Until KeyHit(1)
Question here is, I was setting my canvas to the size of my image, does it hurt anything to have a image that overlaps the canvas?
Thanks, John.
I was trying to implement sliders into my program and I came across a problem. I wrote this little code piece as simple as possible to show the problem.
win = CreateWindow("Test window",0,0,400,400)
can = CreateCanvas(0,0,400,400,win)
SetGadgetLayout can,1,0,1,0
hslider = CreateSlider(0,ClientHeight(win)-18,ClientWidth(win)-20,18,win)
vslider = CreateSlider(ClientWidth(win)-18,0,18,ClientHeight(win),win,2)
Repeat
Until KeyHit(1)
Now what I am having issues with is when the slider bar is over the canvas it wont operate, but resize the window so the bar is off the canvas and it does operate. You can see with 2 sliders you can have one on the canvas and one off the canvas.
Questions
1) Is this how sliders work, if not what am I missing.
2) If this is how sliders work, does it mean I have to resize the canvas so its area is inside of the sliders.
would it be something like this -
win = CreateWindow("Test window",0,0,400,400)
can = CreateCanvas(0,0,400,400,win)
SetGadgetLayout can,1,0,1,0
hslider = CreateSlider(0,ClientHeight(win)-18,ClientWidth(win)-20,18,win)
vslider = CreateSlider(ClientWidth(win)-18,0,18,ClientHeight(win),win,2)
Repeat
If WaitEvent() = $802 Then
SetGadgetShape can, 0,0,ClientWidth(win)-30,ClientHeight(win)-30
SetGadgetShape hslider, 0,ClientHeight(win)-18,ClientWidth(win)-20,18
SetGadgetShape vslider, ClientWidth(win)-18,0,18,ClientHeight(win)
EndIf
Until KeyHit(1)
Question here is, I was setting my canvas to the size of my image, does it hurt anything to have a image that overlaps the canvas?
Thanks, John.