none
Scrollable Interiors

    Question

  • How do you set up a Scrollable Interior

    [code]

    #include once "windows.bi"
    #include once "win\commdlg.bi"

    Dim As MSG msg
    Dim shared As HWND hWnd , Statics , edit_1 , edit_2

    ' Create window
    hWnd = CreateWindowEx( 0, "#32770", "Scroll Test", _
                            WS_OVERLAPPEDWINDOW Or     _
                            WS_VISIBLE          or     _
                            WS_HSCROLL or WS_VSCROLL,  _
                            100,                       _
                            100,                       _
                            640,                       _
                            480,                       _
                            0,                         _
                            0,                         _
                            0,                         _
                            0                          _
                          )

    [/code]

    The WS_HSCROLL and WS_VSCROLL  don't have any effect ,

    They create the scrollbars but their non-functional scrollbars.

    I have more edits and buttons to put in the main window interior than its size can hold

    and I need for the main interior to scroll,  you would think the parent would create its own scrollbars,

    and turn them on if any childs position is beyond the confines of the interior.

     

    Friday, September 21, 2012 8:24 PM

Answers

  • Windows simply notifies the window that the user is interacting with its scroll bars by sending the window WM_HSCROLL or WM_VSCROLL window messages. It does not provide any default handling for scrolling the window’s content.

    The window is responsible for scrolling its content when handling WM_HSCROLL and/or WM_VSCROLL window messages in its window procedure. The sample code in the "Using Scroll Bars" documentation simply demonstrates scrolling text/bitmap content handling WM_HSCROLL/WM_VSCROLL window messages. In your scenario, your application would handle WM_HSCROLL/WM_VSCROLL messages by changing the position of the child windows being scrolled by calling ScrollWindowEx or DeferWindowPos.

    Monday, October 1, 2012 8:28 PM
    Moderator

All replies

  • Hi albert_redditt,

    I would like to know which language you are using? It seems not like VB.NET or C.

    Did you translate and dispatch message in your application? If not, the scrollbar will not be functional.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, September 25, 2012 5:15 AM
    Moderator
  • I set up VSCROLL and HSCROLL in the CreateWindowEX.  but they don't function, and i don't know how to get their values.

    =============================================================================

    What i need is a simple way to put several multiline edits on a scrollable interior , with a little spacing in betwen each edit, for a row of buttons.

    The edits need to be like 3 lines high and all have H & V scrollbars , the edits will be holding string numbers of maybe up to a million digits.

    ========================================================================================

    Its for the next version of BigCalc_V14 , BigCalc_V15

    I'm writing it in FreeBasic,  FreeBasic can blend in C / C++ libraries if the headers are written in FreeBasic using Alias's.

    Maybe someone could give me some example of how to get an interior, or better yet , a static on the interior to be scrollable?? 

    Thats the question, i need some example code.

    Tuesday, September 25, 2012 5:29 AM
  • Hi albert,

    I'm afraid FreeBasic is not supported in this forum.

    Would like to see whether this article will be helpful? There are some code snippet in it:

    http://www.jose.it-berater.org/smfforum/index.php?topic=1299.0

    Best regards,

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information for your  convenience. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    Chester Hong
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, September 27, 2012 9:02 AM
    Moderator
  • HI Mr. Hong.

    ========================================================

    Thanks for the link , its kind of long winded though.

    ========================================================

    FreeBasic code isn't really required , The windows API is (sort of) language independant.

    _

    Another up and coming Compiler is called Oxygen Basic , it can output 32 and 64 bit code. Its currently in Alpha 0.39 stage , but pretty functional, it also has a linkable compiler to compile end-user input code on the fly , for user input math formulas or general code.

    Thanks again for the link...

    =============================================================================

    But what I needed was not to scroll TEXT , but to scroll 16 EDIT boxes with a row of BUTTONS between the EDITS.

    My MAIN window is going to be 800 x 600 , and will have an output EDIT , and 15 input EDIT's with a row of BUTTONS, below each input EDIT, for different things.

    ( Its for a Calculator that does formulas on huge string numbers. )


    Thursday, September 27, 2012 7:59 PM
  • Please refer to the Win32 documentation on “Using Scroll Bars” at http://msdn.microsoft.com/en-us/library/windows/desktop/bb787531(v=vs.85).aspx. The documentation contains some sample code that demonstrates scrolling text and bitmap content.

    Applications are responsible for scrolling the content in their windows by handling WM_HSCROLL and/or WM_VSCROLL window messages and moving the window's content accordingly. The position of child windows can be modified by calling the ScrollWindowEx function or the DeferWindowPos function.


    Trevor Hancock (Microsoft)
    Please remember to "Mark As Answer" the replies that help.

    Monday, October 1, 2012 5:51 PM
    Moderator
  • The scrollable "BitMap" doesn't really help. 

    I'm not going to be able to put useable multiline scrollable Edits and buttons in a bitmap.

    ===========================================================================

    You would think the main window would automatically insert and activate the H / V scrollbars,

    anytime a child control is out of range of the windows display size parameters.

    Monday, October 1, 2012 6:38 PM
  • I know very little about C & C++. In dotnet you would simply use a ScrollableControl.

    Maybe the MSDN documentation for Scrollbars will help you:


    Mick Doherty
    http://dotnetrix.co.uk
    http://glassui.codeplex.com


    Monday, October 1, 2012 7:08 PM
  • Windows simply notifies the window that the user is interacting with its scroll bars by sending the window WM_HSCROLL or WM_VSCROLL window messages. It does not provide any default handling for scrolling the window’s content.

    The window is responsible for scrolling its content when handling WM_HSCROLL and/or WM_VSCROLL window messages in its window procedure. The sample code in the "Using Scroll Bars" documentation simply demonstrates scrolling text/bitmap content handling WM_HSCROLL/WM_VSCROLL window messages. In your scenario, your application would handle WM_HSCROLL/WM_VSCROLL messages by changing the position of the child windows being scrolled by calling ScrollWindowEx or DeferWindowPos.

    Monday, October 1, 2012 8:28 PM
    Moderator
  • So what you guys are saying is Microsoft Windows API, sucks!!!

    I got to play magic with showing and hiding controls and repositioning them on the interior to make it look like its actually scrolling.

    ============================================================

    With that i guess it would be easier to place each of the input edits and associated buttons on a tab page,

    and have the output edit at the top, above the tabs.

    ============================================================

    Microsoft needs to rework their API to be easier , more systematic (intuitive) , more functional with less code.

    Maybe they should have a panel to decide on and assign the names to the API Variables and Function Calls..

    A panel where no one could get demoted or fired for objecting to or countering a proposal..

    Tuesday, October 2, 2012 12:39 AM
  • We are not saying that at all.

    You chose to use a C based language. A C based language gives you, the programmer, control over how the window acts/reacts. If you want simple then you should be using a language which does most of the work for you and gives you less control.

    The Windows API cannot assume that you want to move child controls just because you've added some to the window. Scrollbars were originally intended to scroll text. This is why they have two increment values, LineSize and PageSize which are also commonly known as SmallChange and LargeChange.

    You do not have to hide any controls. You simply react to the WM_HSCROLL and WM_VSCROLL messages and use standard API methods to tell the window how many pixels (assuming that you're using a pixel based worldspace) you want the controls to move based upon the type of scroll event. If windows API automatically did this and you didn't want controls to move then you would be even more upset as it would be much harder to take the function away than to add it with the methods provided for the purpose.


    Mick Doherty
    http://dotnetrix.co.uk
    http://glassui.codeplex.com


    edit: I see you're not using a C-based language, just using C-based API, but the result is the same. Does FreeBasic not have a standard ScrollableControl which you can use?
    Wednesday, October 3, 2012 5:57 PM
  • FreeBasic allows you to link to any C / C++ libs as long as the header is in FreeBasic, This means that all the function calls, have to be preceeded by an ALIAS keyword, to tie the two languages together.

    If there is a sub called xClearScreen in an external library and you want to reference it with the name ClearVideoScreen, here is sample code to do so:
    
    Declare Sub ClearVideoScreen Alias "xClearScreen" ()
    
    
    
    A procedure meant to be used by external C code, exported as MyExportedProc:
    
    Function MultiplyByFive cdecl Alias "MyExportedProc" (ByVal Parameter As Integer) As Integer Export
      Return Parameter * 5
    End Function
    
    
    
    
    Differences from QB
    
    
    In QB, Alias only worked with Declare.
    

    But With the Windows API, if you set your window to be 800x600 and you stick a BUTTON control in at vertical 700 , the window should create a scrollbar and activate it, to allow for scrolling the BUTTON into the window view.

    Also if you set your window to be 800x600 and you stick in a Edit control thats 1024 Horizontal size, the window should create a horizontal scrollbar and activate it to allow scrolling to the end of the Edit...

    Wednesday, October 3, 2012 7:56 PM