Scrollable interior
Scrollable interior
How do you put a form on a window bigger than the window , and get it to scroll the form?
I've got 22 buttons in a row , and 16 buttons in a column. so i need an array of buttons , buttton( 22 , 16 )
To fit on a scrollable form in the main window.
I've got 22 buttons in a row , and 16 buttons in a column. so i need an array of buttons , buttton( 22 , 16 )
To fit on a scrollable form in the main window.
Re: Scrollable interior
I think its called a static control...
I need to get the main program window , to auto scroll the static , with the buttons on the static.
I need to get the main program window , to auto scroll the static , with the buttons on the static.
Re: Scrollable interior
I got the static control in the main window.. And i got scroll bars on the main window...
But it' not scrolling...
I need it to auto scroll when you get to the edge of the window.
But it' not scrolling...
I need it to auto scroll when you get to the edge of the window.
Code: Select all
#define WIN_INCLUDEALL
#include once "windows.bi"
#include once "win\commctrl.bi"
Dim As MSG msg
Dim Shared As HWND hWnd, statics , edit
' Create window
hWnd = CreateWindowEx( 0, "#32770", "Bitmap Button Test", WS_OVERLAPPEDWINDOW Or WS_VISIBLE or WS_HSCROLL or WS_VSCROLL, 100, 0, 200, 100, 0, 0, 0, 0 )
statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 1000 , 1000 , hWnd, 0, 0, 0 )
edit = CreateWindowEx( 0, "BUTTON", "Button" , WS_BORDER Or WS_VISIBLE Or WS_CHILD or ANSI_CHARSET OR BS_PUSHBUTTON OR BS_BITMAP, 10 , 10 , 50 , 20 , statics, 0, 0, 0 )
While GetMessage( @msg, 0, 0, 0 )
TranslateMessage( @msg )
DispatchMessage( @msg )
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273 : PostQuitMessage(0)
End Select
End Select
Wend
PostQuitMessage(0)
End
Re: Scrollable interior
I can use the mouse wheel, but no success with the scroller yet.
Code: Select all
#define WIN_INCLUDEALL
#include once "windows.bi"
#include once "win\commctrl.bi"
Dim As MSG msg
Dim Shared As HWND hWnd, statics , edit
dim as point ep
' Create window
hWnd = CreateWindowEx( 0, "#32770", "Bitmap Button Test plus mouse wheel", WS_OVERLAPPEDWINDOW Or WS_VISIBLE or WS_HSCROLL or WS_VSCROLL, 100, 0, 800, 600, 0, 0, 0, 0 )
'statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 1000 , 1000 , hWnd, 0, 0, 0 )
edit = CreateWindowEx( 0, "BUTTON", "Button" , WS_BORDER Or WS_VISIBLE Or WS_CHILD or ANSI_CHARSET OR BS_PUSHBUTTON OR BS_BITMAP, 10 , 10 , 50 , 20 , hwnd, 0, 0, 0 )
ep.x=10
ep.y=10
While GetMessage( @msg, 0, 0, 0 )
TranslateMessage( @msg )
DispatchMessage( @msg )
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273 : PostQuitMessage(0)
End Select
Select Case msg.hwnd
case hwnd
if msg.message = WM_mousewheel Then
'case WM_VSCROLL
' dim as scrollinfo si
' ZeroMemory(@si, sizeof(si))
' si.cbSize = sizeof(si)
'si.fMask = SIF_TRACKPOS
'GetScrollinfo(hwnd,SB_VERT ,@si)
'position=si.nTrackPos
static as integer wheel
var wh = GET_WHEEL_DELTA_WPARAM(msg.wparam)
wheel+=wh/12'WHEEL_DELTA
print wheel
movewindow(edit,ep.x,ep.y+wheel,50,20,1)
updatewindow(edit)
end if
end select
End Select
Wend
PostQuitMessage(0)
End
Re: Scrollable interior
@Dodicat
I got it scrolling the static with the button on it...
But it only scrolls up & down , can't get it scrolling left & right.
I have a touch-pad on my laptop , it should register two-finger V & H scrolling.
I got it scrolling the static with the button on it...
But it only scrolls up & down , can't get it scrolling left & right.
I have a touch-pad on my laptop , it should register two-finger V & H scrolling.
Code: Select all
#define WIN_INCLUDEALL
#include once "windows.bi"
#include once "win\commctrl.bi"
Dim As MSG msg
Dim Shared As HWND hWnd, statics , edit
dim as point ep
' Create window
hWnd = CreateWindowEx( 0, "#32770", "Bitmap Button Test plus mouse wheel", WS_OVERLAPPEDWINDOW Or WS_VISIBLE or WS_HSCROLL or WS_VSCROLL, 100, 0, 800, 600, 0, 0, 0, 0 )
statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 1000 , 1000 , hWnd, 0, 0, 0 )
edit = CreateWindowEx( 0, "BUTTON", "Button" , WS_BORDER Or WS_VISIBLE Or WS_CHILD or ANSI_CHARSET OR BS_PUSHBUTTON OR BS_BITMAP, 10 , 10 , 50 , 20 , statics , 0, 0, 0 )
ep.x=10
ep.y=10
While GetMessage( @msg, 0, 0, 0 )
TranslateMessage( @msg )
DispatchMessage( @msg )
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273 : PostQuitMessage(0)
End Select
Select Case msg.hwnd
case hwnd
if msg.message = WM_mousewheel Then
'case WM_VSCROLL
' dim as scrollinfo si
' ZeroMemory(@si, sizeof(si))
' si.cbSize = sizeof(si)
'si.fMask = SIF_TRACKPOS
'GetScrollinfo(hwnd,SB_VERT ,@si)
'position=si.nTrackPos
static as integer wheel
var wh = GET_WHEEL_DELTA_WPARAM(msg.wparam)
wheel+=wh/12'WHEEL_DELTA
print wheel
if wheel < = 0 and wheel > -1000 then
movewindow(statics,ep.x,ep.y+wheel,1000,1000,1)
updatewindow(statics)
end if
end if
end select
End Select
Wend
PostQuitMessage(0)
End
Re: Scrollable interior
@Dodicat
I'd like to get it reading the mouse , x , y ,
and scrolling a button width , or a button height , when you get to the left or right side , or top or bottom of the screen.
When you get to a window edge (top / bottom or left / right ) it will scroll in that direction by a button width or height..
I'd like to get it reading the mouse , x , y ,
and scrolling a button width , or a button height , when you get to the left or right side , or top or bottom of the screen.
When you get to a window edge (top / bottom or left / right ) it will scroll in that direction by a button width or height..
Re: Scrollable interior
@Dodicat
I got it scrolling through , just the height of the static...somehow need to get window sizes or control sizes to adapt it.?
We need mouse X , Y , instead of mouse wheel.
Then when the mouse gets within a button height or width from the border it scrolls by a button height or width.
I got it scrolling through , just the height of the static...somehow need to get window sizes or control sizes to adapt it.?
We need mouse X , Y , instead of mouse wheel.
Then when the mouse gets within a button height or width from the border it scrolls by a button height or width.
Code: Select all
#define WIN_INCLUDEALL
#include once "windows.bi"
#include once "win\commctrl.bi"
Dim As MSG msg
Dim Shared As HWND hWnd, statics , edit
dim as point ep
' Create window
hWnd = CreateWindowEx( 0, "#32770", "Bitmap Button Test plus mouse wheel", WS_OVERLAPPEDWINDOW Or WS_VISIBLE , 100, 0, 800, 600, 0, 0, 0, 0 )
statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 1000 , 1000 , hWnd, 0, 0, 0 )
edit = CreateWindowEx( 0, "BUTTON", "Button" , WS_BORDER Or WS_VISIBLE Or WS_CHILD or ANSI_CHARSET OR BS_PUSHBUTTON OR BS_BITMAP, 10 , 10 , 50 , 20 , statics , 0, 0, 0 )
ep.x=10
ep.y=10
While GetMessage( @msg, 0, 0, 0 )
TranslateMessage( @msg )
DispatchMessage( @msg )
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273 : PostQuitMessage(0)
End Select
Select Case msg.hwnd
case hwnd
if msg.message = WM_mousewheel Then
'case WM_VSCROLL
' dim as scrollinfo si
' ZeroMemory(@si, sizeof(si))
' si.cbSize = sizeof(si)
'si.fMask = SIF_TRACKPOS
'GetScrollinfo(hwnd,SB_VERT ,@si)
'position=si.nTrackPos
static as integer wheel
var wh = GET_WHEEL_DELTA_WPARAM(msg.wparam)
wheel+=wh/12'WHEEL_DELTA
print wheel
if wheel < = 0 and wheel > -(1000-525) then
movewindow(statics,ep.x,ep.y+wheel,1000,1000,1)
updatewindow(statics)
end if
end if
end select
End Select
Wend
PostQuitMessage(0)
End
Re: Scrollable interior
Dodicat
Thanks for your help... I got it scrolling both H and V..
Thanks for your help... I got it scrolling both H and V..
Code: Select all
#define WIN_INCLUDEALL
#include once "windows.bi"
#include once "win\commctrl.bi"
Dim As MSG msg
Dim Shared As HWND hWnd, statics , edit
dim as point ep
' Create window
hWnd = CreateWindowEx( 0, "#32770", "Bitmap Button Test plus mouse wheel", WS_OVERLAPPEDWINDOW Or WS_VISIBLE , 100, 0, 800, 600, 0, 0, 0, 0 )
statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 1000 , 1000 , hWnd, 0, 0, 0 )
edit = CreateWindowEx( 0, "BUTTON", "Button" , WS_BORDER Or WS_VISIBLE Or WS_CHILD or ANSI_CHARSET OR BS_PUSHBUTTON OR BS_BITMAP, 10 , 10 , 50 , 20 , statics , 0, 0, 0 )
ep.x = 0
ep.y = 0
dim as longint mouse_x
dim as longint mouse_y
While GetMessage( @msg, 0, 0, 0 )
TranslateMessage( @msg )
DispatchMessage( @msg )
mouse_x = LoWord(msg.LPARAM)
mouse_y = HiWord(msg.LPARAM)
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273 : PostQuitMessage(0)
End Select
Select Case msg.hwnd
case hwnd
if msg.message = WM_MOUSEMOVE then
print mouse_x , mouse_y
if mouse_x >= 790 then
if ep.x <= 800 then ep.x+=50
movewindow(statics,-ep.x,ep.y,1000,1000,1)
updatewindow(statics)
end if
if mouse_x <= 10 then
if ep.x >= 0 then ep.x-=50
movewindow(statics,-ep.x,-ep.y,1000,1000,1)
updatewindow(statics)
end if
if mouse_y >= 550 then
if ep.y <= 600 then ep.y+=25
movewindow(statics,-ep.x,-ep.y,1000,1000,1)
updatewindow(statics)
end if
if mouse_y <= 10 then
if ep.y >= 0 then ep.y-=25
movewindow(statics,-ep.x,-ep.y,1000,1000,1)
updatewindow(statics)
end if
end if
'if msg.message = WM_mousewheel Then
'case WM_VSCROLL
' dim as scrollinfo si
' ZeroMemory(@si, sizeof(si))
' si.cbSize = sizeof(si)
'si.fMask = SIF_TRACKPOS
'GetScrollinfo(hwnd,SB_VERT ,@si)
'position=si.nTrackPos
' static as integer wheel
'var wh = GET_WHEEL_DELTA_WPARAM(msg.wparam)
'wheel+=wh/12'WHEEL_DELTA
'print wheel
'if wheel < = 0 and wheel > -(1000-525) then
' movewindow(statics,ep.x,ep.y+wheel,1000,1000,1)
' updatewindow(statics)
'end if
'end if
end select
End Select
Wend
PostQuitMessage(0)
End
Re: Scrollable interior
@Dodicat
I got it working....Now just to get control size put into it..
I got it working....Now just to get control size put into it..
Code: Select all
#define WIN_INCLUDEALL
#include once "windows.bi"
#include once "win\commctrl.bi"
Dim Shared As String consonants(1 To 22)
Dim Shared As String vowels(1 To 16)
consonants(01) = "H"
consonants(02) = "Y"
consonants(03) = "W"
consonants(04) = "R"
consonants(05) = "S"
consonants(06) = "Z"
consonants(07) = "K"
consonants(08) = "G"
consonants(09) = "F"
consonants(10) = "V"
consonants(11) = "L"
consonants(12) = "Th"
consonants(13) = "B"
consonants(14) = "P"
consonants(15) = "M"
consonants(16) = "N"
consonants(17) = "D"
consonants(18) = "T"
consonants(19) = "Ch"
consonants(20) = "J"
consonants(21) = "Sh"
consonants(22) = "Zh"
vowels(01) = "uh" ' hut
vowels(02) = "ah" ' tah
vowels(03) = "ew" ' too
vowels(04) = "oh" ' go
vowels(05) = "ow" ' how
vowels(06) = "oo" ' foot
vowels(07) = "aw" ' paw
vowels(08) = "iw" ' elmer fudd "hill"
vowels(09) = "a" ' at
vowels(10) = "eh" ' hell
vowels(11) = "ih" ' hill
vowels(12) = "ay" ' hay
vowels(13) = "ie" ' pie
vowels(14) = "ee" ' pee
vowels(15) = "au" ' bostonian O , aw with your lips pushed out
vowels(16) = "oi" ' boy
Dim As MSG msg
Dim Shared As HWND hWnd, statics , characters(1 To 352)
dim as point ep
' Create window
hWnd = CreateWindowEx( 0, "#32770", "Bitmap Button Test plus mouse wheel", WS_OVERLAPPEDWINDOW Or WS_VISIBLE , 100, 0, 800, 600, 0, 0, 0, 0 )
statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 1000 , 1000 , hWnd, 0, 0, 0 )
'create buttons for each syllable
Dim Shared As Integer button , x_pos , y_pos , vowel
button= 1
x_pos = 1
y_pos = 1
vowel = 1
For y As Integer = 1 To 16
x_pos = 10
vowel = y
For x As Integer = 1 To 22
characters(button) = CreateWindowEx( 0, "BUTTON", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD or ANSI_CHARSET , x_pos , y_pos , 40 , 15 , statics, 0, 0, 0 )
'SendMessage(characters(button),WM_SETFONT , Cast(WPARAM,fonthdl_1),0 )
SetWindowText( characters(button) , consonants(x) + vowels(vowel) )
button+=1
x_pos+=40
if consonants(x) = "Y" then x_pos+=10
if Consonants(x) = "R" then x_pos+=10
if Consonants(x) = "Z" then x_pos+=10
if Consonants(x) = "G" then x_pos+=10
if Consonants(x) = "V" then x_pos+=10
if Consonants(x) = "Th" then x_pos+=10
if Consonants(x) = "M" then x_pos+=10
if Consonants(x) = "T" then x_pos+=10
Next
y_pos+=40
Next
ep.x = 0
ep.y = 0
dim as longint mouse_x
dim as longint mouse_y
While GetMessage( @msg, 0, 0, 0 )
TranslateMessage( @msg )
DispatchMessage( @msg )
mouse_x = LoWord(msg.LPARAM)
mouse_y = HiWord(msg.LPARAM)
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273 : PostQuitMessage(0)
End Select
Select Case msg.hwnd
case hwnd
if msg.message = WM_MOUSEMOVE then
print ep.x , ep.y , mouse_x , mouse_y
if mouse_x >= 800-50 then
if ep.x <= 200 then ep.x+=50
movewindow(statics,-ep.x,-ep.y,1000,1000,1)
updatewindow(statics)
end if
if mouse_x <= 50 then
if ep.x >= 0 then ep.x-=50
movewindow(statics,-ep.x,-ep.y,1000,1000,1)
updatewindow(statics)
end if
if mouse_y >= 600-50 then
if ep.y <= 200 then ep.y+=25
movewindow(statics,-ep.x,-ep.y,1000,1000,1)
updatewindow(statics)
end if
if mouse_y <= 50 then
if ep.y >= 0 then ep.y-=25
movewindow(statics,-ep.x,-ep.y,1000,1000,1)
updatewindow(statics)
end if
end if
'if msg.message = WM_mousewheel Then
'case WM_VSCROLL
' dim as scrollinfo si
' ZeroMemory(@si, sizeof(si))
' si.cbSize = sizeof(si)
'si.fMask = SIF_TRACKPOS
'GetScrollinfo(hwnd,SB_VERT ,@si)
'position=si.nTrackPos
' static as integer wheel
'var wh = GET_WHEEL_DELTA_WPARAM(msg.wparam)
'wheel+=wh/12'WHEEL_DELTA
'print wheel
'if wheel < = 0 and wheel > -(1000-525) then
' movewindow(statics,ep.x,ep.y+wheel,1000,1000,1)
' updatewindow(statics)
'end if
'end if
end select
End Select
Wend
PostQuitMessage(0)
End
Re: Scrollable interior
@Dodicat
I got it working finally!!!
You can adjust the window size , and scroll up & down and left & right..
I got it working finally!!!
You can adjust the window size , and scroll up & down and left & right..
Code: Select all
#define WIN_INCLUDEALL
#include once "windows.bi"
#include once "win\commctrl.bi"
Dim Shared As String consonants(1 To 22)
Dim Shared As String vowels(1 To 16)
consonants(01) = "H"
consonants(02) = "Y"
consonants(03) = "W"
consonants(04) = "R"
consonants(05) = "S"
consonants(06) = "Z"
consonants(07) = "K"
consonants(08) = "G"
consonants(09) = "F"
consonants(10) = "V"
consonants(11) = "L"
consonants(12) = "Th"
consonants(13) = "B"
consonants(14) = "P"
consonants(15) = "M"
consonants(16) = "N"
consonants(17) = "D"
consonants(18) = "T"
consonants(19) = "Ch"
consonants(20) = "J"
consonants(21) = "Sh"
consonants(22) = "Zh"
vowels(01) = "uh" ' hut
vowels(02) = "ah" ' tah
vowels(03) = "ew" ' too
vowels(04) = "oh" ' go
vowels(05) = "ow" ' how
vowels(06) = "oo" ' foot
vowels(07) = "aw" ' paw
vowels(08) = "iw" ' elmer fudd "hill"
vowels(09) = "a" ' at
vowels(10) = "eh" ' hell
vowels(11) = "ih" ' hill
vowels(12) = "ay" ' hay
vowels(13) = "ie" ' pie
vowels(14) = "ee" ' pee
vowels(15) = "au" ' bostonian O , aw with your lips pushed out
vowels(16) = "oi" ' boy
Dim As MSG msg
Dim Shared As HWND hWnd, statics , characters(1 To 352)
dim as point ep
' Create window
hWnd = CreateWindowEx( 0, "#32770", "Bitmap Button Test plus mouse wheel", WS_OVERLAPPEDWINDOW Or WS_VISIBLE , 100, 0, 800, 600, 0, 0, 0, 0 )
statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 1024 , 768 , hWnd, 0, 0, 0 )
'create buttons for each syllable
Dim Shared As Integer button , x_pos , y_pos , vowel
button= 1
x_pos = 1
y_pos = 1
vowel = 1
For y As Integer = 1 To 16
x_pos = 10
vowel = y
For x As Integer = 1 To 22
characters(button) = CreateWindowEx( 0, "BUTTON", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD or ANSI_CHARSET , x_pos , y_pos , 40 , 15 , statics, 0, 0, 0 )
'SendMessage(characters(button),WM_SETFONT , Cast(WPARAM,fonthdl_1),0 )
SetWindowText( characters(button) , consonants(x) + vowels(vowel) )
button+=1
x_pos+=40
if consonants(x) = "Y" then x_pos+=10
if Consonants(x) = "R" then x_pos+=10
if Consonants(x) = "Z" then x_pos+=10
if Consonants(x) = "G" then x_pos+=10
if Consonants(x) = "V" then x_pos+=10
if Consonants(x) = "Th" then x_pos+=10
if Consonants(x) = "M" then x_pos+=10
if Consonants(x) = "T" then x_pos+=10
Next
y_pos+=40
Next
ep.x = 10
ep.y = 10
dim as longint mouse_x
dim as longint mouse_y
While GetMessage( @msg, 0, 0, 0 )
TranslateMessage( @msg )
DispatchMessage( @msg )
mouse_x = LoWord(msg.LPARAM)
mouse_y = HiWord(msg.LPARAM)
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273 : PostQuitMessage(0)
End Select
Select Case msg.hwnd
case hwnd
if msg.message = WM_MOUSEMOVE then
'print "ep.x = " ; ep.x , mouse_x
'print "ep.y = " ; ep.y , mouse_y
Dim As rect r
getwindowrect(hWnd,@r)
var w_wide = r.right-r.left
var w_high = r.bottom-r.top
getwindowrect(statics,@r)
var s_wide = r.right-r.left
var s_high = r.bottom-r.top
if mouse_x >= w_wide-50 then
if ep.x <= (s_wide-mouse_x) then ep.x+=20
movewindow(statics, -ep.x,-ep.y,s_wide,s_high,1)
updatewindow(statics)
end if
if mouse_x <= 50 then
if ep.x > 0 then ep.x-=20
movewindow(statics, -ep.x,-ep.y,s_wide,s_high,1)
updatewindow(statics)
end if
if mouse_y >= w_high-50 then
if ep.y <= (s_high-mouse_y) then ep.y+=20
movewindow(statics,-ep.x,-ep.y,s_wide,s_high,1)
updatewindow(statics)
end if
if mouse_y <= 50 then
if ep.y >= 0 then ep.y-=20
movewindow(statics,-ep.x,-ep.y,s_wide,s_high,1)
updatewindow(statics)
end if
end if
end select
End Select
Wend
PostQuitMessage(0)
End
Re: Scrollable interior
How do you get the CreateWindowEx( + scrollbars working )?
I can't seem to get them workin..
I can't seem to get them workin..
Code: Select all
#define WIN_INCLUDEALL
#Include once "windows.bi"
#Include once "/win/commctrl.bi"
initcommoncontrols()
Dim shared As MSG msg ' Message variable (stores massages)
Dim shared As HWND hWnd , statics
hWnd = CreateWindowEx( 0, "#32770", "TrackBar Test", WS_OVERLAPPEDWINDOW Or WS_VISIBLE or WS_HSCROLL or WS_VSCROLL or SB_BOTH or ESB_ENABLE_BOTH , 100, 0, 800, 600, 0, 0, 0, 0 )
statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 2300 , 1400 , hWnd, 0, 0, 0 )
'begin mesage processing
While GetMessage( @msg, 0, 0, 0 )
dim as WPARAM wparam
dim as LPARAM lparam
TranslateMessage( @msg )
DispatchMessage( @msg )
print msg.message , loword(msg.wparam) , hiword(msg.wparam) , loword(msg.lparam) , hiword(msg.lparam)
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273
PostQuitMessage(0)
'End
end select
end select
Wend
PostQuitMessage(0)
END
Re: Scrollable interior
How do you convert the following C++ code to FB
typedef struct tagSCROLLINFO {
UINT cbSize;
UINT fMask;
int nMin;
int nMax;
UINT nPage;
int nPos;
int nTrackPos;
} SCROLLINFO, *LPSCROLLINFO;
typedef struct tagSCROLLINFO {
UINT cbSize;
UINT fMask;
int nMin;
int nMax;
UINT nPage;
int nPos;
int nTrackPos;
} SCROLLINFO, *LPSCROLLINFO;
Re: Scrollable interior
Like this:albert wrote:How do you convert the following C++ code to FB
Code: Select all
type tagSCROLLINFO
as ulong _
cbSize, _
fMask
as long _
nMin, _
nMax
as ulong _
nPage
as long _
nPos, _
nTrackPos
end type
dim as tagSCROLLINFO _
SCROLLINFO
dim as tagSCROLLINFO ptr _
LPSCROLLINFO
Re: Scrollable interior
Does any one know how to get the scroll bars working?
Code: Select all
#define WIN_INCLUDEALL
#Include once "windows.bi"
#Include once "/win/commctrl.bi"
initcommoncontrols()
Dim shared As MSG msg ' Message variable (stores massages)
Dim shared As HWND hWnd , statics
hWnd = CreateWindowEx( 0, "#32770", "TrackBar Test", WS_OVERLAPPEDWINDOW Or WS_VISIBLE or WS_HSCROLL or WS_VSCROLL or SB_BOTH or ESB_ENABLE_BOTH , 100, 0, 800, 600, 0, 0, 0, 0 )
statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 2300 , 1400 , hWnd, 0, 0, 0 )
'begin mesage processing
While GetMessage( @msg, 0, 0, 0 )
dim as WPARAM wparam
dim as LPARAM lparam
TranslateMessage( @msg )
DispatchMessage( @msg )
print msg.message , loword(msg.wparam) , hiword(msg.wparam) , loword(msg.lparam) , hiword(msg.lparam)
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273
PostQuitMessage(0)
'End
end select
end select
Wend
PostQuitMessage(0)
END
Re: Scrollable interior
I got it altering the thumb size... Change si.nMax = ?? (to adjust the thumb size)
Now to figure out , how to get it scrolling.
Now to figure out , how to get it scrolling.
Code: Select all
#define WIN_INCLUDEALL
#Include once "windows.bi"
#Include once "/win/commctrl.bi"
InitCommonControls()
Dim shared As MSG msg ' Message variable (stores massages)
Dim shared As HWND hWnd , statics
dim shared as SCROLLINFO si
hWnd = CreateWindowEx( 0, "#32770", "TrackBar Test", WS_OVERLAPPEDWINDOW Or WS_VISIBLE or WS_HSCROLL or WS_VSCROLL , 100, 0, 800, 600, 0, 0, 0, 0 )
statics = CreateWindowEx( 0, "STATIC", "" , WS_BORDER Or WS_VISIBLE Or WS_CHILD , 10 , 10 , 2300 , 1400 , hWnd, 0, 0, 0 )
EnableScrollBar(hWnd,SB_BOTH ,ESB_ENABLE_BOTH)
'Set the scrolling range and page size
si.cbSize = sizeof(si)
si.fMask = SIF_RANGE or SIF_PAGE
si.nMin = 0
si.nMax = 1400\200 ' adjust here to change the thumb size
si.nPage = 1
SetScrollInfo(hwnd, SB_VERT, @si, TRUE)
SetScrollInfo(hwnd, SB_HORZ, @si, TRUE)
'begin mesage processing
While GetMessage( @msg, 0, 0, 0 )
dim as WPARAM wparam
dim as LPARAM lparam
TranslateMessage( @msg )
DispatchMessage( @msg )
print msg.message , loword(msg.wparam) , hiword(msg.wparam) , loword(msg.lparam) , hiword(msg.lparam)
Select Case msg.hwnd
Case hWnd
Select Case msg.message
Case 273
PostQuitMessage(0)
'End
end select
end select
Wend
PostQuitMessage(0)
END