Announcement

Collapse
No announcement yet.

Sizing console with buffers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sizing console with buffers

    I'm trying to programmatically create the equivalent of opening a window and dragging the bottom of the console up so it's only 10 lines of text.

    If I use
    Code:
    CONSOLE SET SCREEN 300,80
    I get a standard 80x25 console with a side scroll bar. That's the default. If I use
    Code:
    CONSOLE SET SCREEN 10,80
    I get a 80x10 screen with no scroll bars. Messing around with all the other new (to me at least) console set or get commands doesn't appear to offer any way to get the 80x10 window with a scrollbar on an 80x300 screen. Help please?
    Neil Croft (cissp)

  • #2
    I'm trying to programmatically create the equivalent of opening a window and dragging the bottom of the console up so it's only 10 lines of text.
    Maybe this can help?

    Use Listview control as a console. September 13 2003.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Maybe it could but

      1) Way too complicated for me to grasp and

      2) It doesn't compile and I don't get where it's broken (CALLBACK function seems to be broken as it says function missing) and I wouldn't know where to start to fix that.

      3) It just seems way over the top. I'd just like a CONSOLE SET WINDOW row,column command

      Continuing to play myself and the solution is actually trivial albeit a tad clunky

      Code:
      #BREAK ON
      FUNCTION PBMAIN () AS LONG
      
      CONSOLE SET SCREEN 9,90 'don't know why 9 gives 10 rows.
      
      CONSOLE SET SCREEN 300,80
      
      PRINT "12345678911111111112222222222333333333344444444445555555555666666666677777777778";
      PRINT "2        01234567890123456789012345678901234567890123456789012345678901234567890";
      FOR a&=3 TO 11
          PRINT a&
      NEXT
      PRINT "Done"
      WAITKEY$
      
      END FUNCTION
      Last edited by Neil Croft; 18 Dec 2008, 08:43 AM. Reason: Amended row number. Added full demo source.
      Neil Croft (cissp)

      Comment


      • #4
        Hello Neil.

        The way I do it is to catch the mouse messages by subclassing the control and use procedures for startdrag, enddrag and drawdrag. The drawdrag one for moving the whole GW looks like this (variables with pt are POINTAPI type):

        Code:
                        case %PBFdragGW
                            graphic get loc to X, Y
                            pt.X = endpt.X: pt.Y = endpt.Y
                            ptorigin.X = startpt.X
                            ptorigin.Y = startpt.Y
                            clienttoscreen ghGR, pt
                            clienttoscreen ghGR, ptorigin
                            x = x + pt.X - ptorigin.X 'startpt.X
                            y = y + pt.y - ptorigin.Y 'startpt.Y
                            movewindow ghGR, X, Y, W, H, %true
                            pt.x = endpt.X: pt.Y = endpt.Y
                            clienttoscreen ghGR, pt
                            setcursorpos pt.x, pt.y
        but see also the topic about the scope of the GRAPHIC WINDOW - you may also need to re-attach the window if you are calling GRAPHIC commands from inside the subclassed Wndproc.

        Comment


        • #5
          Neil,

          Take a look at the help for CONSOLE SET VIRTUAL.

          Comment

          Working...
          X