Announcement

Collapse
No announcement yet.

Contools - won't fill screen

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

  • Eric Pearson
    replied
    I'd suggest using PB/Win plus Graphics Tools. You won't need Console Tools unless you are using PB/CC.

    > I searched on "pulldown" in the PB-Win help and got nothing.

    Check out the MENU commands, like MENU NEW BAR.

    One of the main goals of Console Tools is to add GUI elements to a console. If you don't need a console window, you'll be better off with a more direct approach.

    -- Eric

    Leave a comment:


  • Daniel Raymer
    replied
    Thanks - and a PB-Win +Contools question

    I have PB-Win as well but haven't used it. Do you recommend that I use it with Contools & GFX instead of PBCC, or are you suggesting that I completely rethink my approach? I searched on "pulldown" in the PB-Win help and got nothing. Contools makes it easy!

    Leave a comment:


  • Eric Pearson
    replied
    Dan --

    Okay, I see the problem and... I don't see an easy solution.

    The issue is that the task bar's Show Desktop function (aka Minimize All Windows) bypasses the normal Windows protocol. If you were to use PB/Win to create a GUI application that didn't expect to be minimized (i.e. purposely disabled its Minimize button), you would experience the same problem.

    Because of the way certain versions of Windows work, it isn't practical for a Console Tools PulldownMenu to have a minimize button. Believe me, we tried. So by clicking the Show Desktop button you are telling Windows to force-minimize a window that wasn't intended to be minimized, and the window is getting confused about its state. If the PulldownMenu function is active (waiting for a selection) and somebody clicks Show Desktop or Minimize All Windows, I would expect problems.

    or should we tell users "just don't do that" ?
    I hate to say it, but that's the only option I see right now. For the record I do consider this to be a newly discovered bug in Console Tools, but I'm not certain that it can be fixed. Console Tools does its best to make consoles look like GUIs, but it can only go so far.

    Dan, to be honest, it doesn't seem like PBCC+ConsoleTools+GraphicsTools is the best way to accomplish your apparent goal. You are jumping through hoops (see first post) to create a console window that fills the screen, then you are completely covering up the console with a pulldown menu and a graphics window. Except for the text hole, the console is out of sight. For an interface that looks like that, instead of PB/CC you'd be better off using PBWin to create a real-live GUI program.

    -- Eric Pearson, Perfect Sync, Inc.

    Leave a comment:


  • Eric Pearson
    replied
    Oops, never mind. I found it on the QuickStart toolbar (which I had disabled).

    Leave a comment:


  • Eric Pearson
    replied
    if you click the ShowDesktop icon on the Windows Taskbar
    I can't seem to replicate your problem. In fact I don't have a ShowDesktop icon on any of my test machines. Which version of Windows are you using?

    -- Eric

    Leave a comment:


  • Daniel Raymer
    replied
    Eric - please, please, please...

    ....can you take a look at the "won't come back" problem described in my last post? Is it something strange in my code, or is it generic to all Contools/GFX programs? Is there a fix, or a workaround, or should we tell users "just don't do that" ?

    Thanks, sorry to bug you by name, but you KNOW STUFF !!!!

    Leave a comment:


  • Daniel Raymer
    replied
    Nearly Perfect Now - except for....

    Eric & the Lurkers,

    I fixed the Windows Taskbar problem by changing spYSize to:
    spYSize = ConsoleInfo(%DESKTOP_HEIGHT) 'was %SCREEN_HEIGHT

    I've decided, as a payback for the help I've gotten from you all, to help others by posting a "skeleton" or "wrapper" code that gets everything ready - console set, graphics window set, drawing units set, pulldown window set, and all as big as possible without covering up the taskbar. People can start with this, then plop in their working code in the pulldown menu cases. The code (below) also includes samples of some Contools and GFX features that I find most useful. I sure wish I'd found this back when I started using PB/CC !

    One problem I cannot fix - when this is running, if you click the ShowDesktop icon on the Windows Taskbar, then press the program icon on the Taskbar, the program doesn't always reappear - instead it sometimes briefly flashes then disappears. To make this happen you might have to go back and forth a few times, and maybe Alt-Tab to something in between. To get out of it you have to click ShowDesktop again, then the program icon - and maybe repeat that a few times too! Annoying, and other Windows programs don't do it.

    Any ideas? When this code is fixed I'll post it in Source Code.

    Code:
    '----------------------------------------------------------------------------------------------------------
    '*****************         Raymer's Wrapper: PBCC with Contools & GFX     *********************************
    '----------------------------------------------------------------------------------------------------------
    '     sets up Console to fill Desktop except for Windows Task Bar                                   5-28-08
    '     sets up Graphics screen as full Console and sets scale as (X=1 to nXu), (Y=1 to nYu) for GFX drawing
    '     sets up Pulldown Menu with loop to check and execute selections (put your working code as Cases)
    '     Copyright C 2008 by D. Raymer, but permission hereby given to use this however you wish
    '     Disclaimer - use at your own risk, no promises or guarantees are offered !
    '     Thanks to Eric Pearson and the PowerBasic lurkers who answered my stupid questions until this worked!
    
    #REGISTER NONE
    #INCLUDE "c:\GFXTOOLS\GFXT_Pro.INC"
    #INCLUDE "c:\CONTOOLS\CT_Pro.INC"
    %MAXMENUBUFFER=100
    GLOBAL nXu AS LONG, nYu AS LONG                   'number of X & Y drawing units in Window
    GLOBAL nXp AS LONG, nYp AS LONG                   'number of X & Y pixels in Window
    
    '----------------------------------------------------------------------------------------------------------
    FUNCTION WINMAIN(BYVAL hCurInstance  AS LONG, BYVAL hPrevInstance AS LONG, _
                          BYVAL lpszCmdLine AS ASCIIZ PTR, BYVAL nCmdShow AS LONG) EXPORT AS LONG
    
    DIM spXSize AS LOCAL SINGLE     'these needed for console sizing - from Stretch.bas
    DIM spYSize AS LOCAL SINGLE
    
    MyContoolsGFXauthorizeCode&=      '<<<< put your authorization code here >>>>>
    
    ConsoleToolsAuthorize MyContoolsGFXauthorizeCode&
    lResult& = InitConsoleTools(hCurInstance, %MAXMENUBUFFER, 2, 3, 0, 0) ' 2 screen save buffers ; 3=using new GFX-Pro
    lResult2& = GraphicsToolsAuthorize(MyContoolsGFXauthorizeCode&)
    ConsoleToolBar %OFF, %NO_CHANGE
    DeleteWindowMenuItem %MENUITEM_SIZE               'Contools routine to make sure the user can't do bad things
    DeleteWindowMenuItem %MENUITEM_CLOSE              'Make sure user can't Alt-F4 to shut down
    DeleteWindowMenuItem %MENUITEM_TOOLBAR
    DeleteWindowMenuItem %MENUITEM_PROPERTIES
    
    '----maximize console window to fill desktop (less toolbar)
    spXSize = ConsoleInfo(%SCREEN_WIDTH) / ConsoleMetrics(%COL_WIDTH)
    spYSize = ConsoleInfo(%DESKTOP_HEIGHT)          'was %SCREEN_HEIGHT but covers up Windows Task Bar
    spYSize = spYSize - ConsoleMetrics(%TITLEBAR_HEIGHT) - ConsoleMetrics(%FRAME_HEIGHT)
    spYSize = spYSize / ConsoleMetrics(%ROW_HEIGHT)
    ConsoleControl %BUFFER_WIDTH,  INT(spXSize)
    ConsoleControl %BUFFER_HEIGHT, INT(spYSize)
    ConsoleStretch
    ConsoleToForeground %SOFT
    ConsoleMove 0-ConsoleMetrics(%FRAME_WIDTH)-ConsoleMetrics(%BORDER_SIZE),0-ConsoleMetrics(%FRAME_HEIGHT)
    
    '----Set up Contools Pulldown Menu
    MenuDefinition 1, "&File > 2   | &Options > 3 | &Help > 4"
    MenuDefinition 2, "&Open File= 201 | &Close File= 202 | E&xit=203"
    MenuDefinition 3, "Do something else...=301    | Do even more....=302"
    MenuDefinition 4, "Help me &Rhonda=401  | &About=402"
    lResult& = MenuSystemCreate(1,%MAXMENUBUFFER)  'Contools pulldown menu creation (actually called below in DO loop)
    
    ConsoleGfx 0,0,0,0                             'Initialize graphics window, using all rows and columns of console window
    
    GfxFont "Arial", 40, 20, 1, %BLACK,0,0         'GfxFont(sFontName$,lWidth&,lHeight&,lWeight&,lColor&,lEffects&,dpAngle#)
    PenColor %BLACK                                'set color of lines drawn by GFX
    BrushColor %WHITE                              'set color of brush in GFX (including background via GfxCLS)
    GfxCLS
    GfxWindow %SHOW                                'Show the graphics window
    
    '~~~~~~~set up Drawing Units ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    nXp=GfxMetrics(%GFX_DRAWING_WIDTH)          'horizontal (X) size of graphics window-pixels
    nYp=GfxMetrics(%GFX_DRAWING_HEIGHT)         'vertical (Y) size of graphics window-pixels
    GfxOption  %GFX_HORIZ_SCALE, 4096           'arbitrarily selected = 64*64
    GfxOption  %GFX_VERT_SCALE, 2*ROUND(((4096*nYp/nXp)/2.), 0)   'or opt bitmap perf, use even number of pixels
    nXu=GfxMetrics(%GFX_HORIZ_SCALE)            'number of horizontal (X) Drawing Units
    nYu=GfxMetrics(%GFX_VERT_SCALE)             'number of vertical (Y) Drawing Units
    
    numRows& = RowOfLoc(nYp)                    'number of Rows for Locate
    numCols& = ColOfLoc(nXp)                    'number of Cols for Locate
    
    '------------- a few sample GFX commands
    GfxWindow %GFX_FREEZE                          'Freeze the graphics window while drawing to it  (much faster)
    StretchBitmap "CLIPBOARD",nXu,nYu              'shows current Windows clipboard image across entire Console image area
    DrawLine 0.1*nXu,0.1*nYu,0.9*nXu,0.5*nYu       'lStartX&,lStartY&,lEndX&,lEndY& in drawing units
    
    Text2Show$="  Raymer's Wrapper Text Print Sample (if something is in the Windows Clipboard, it is displayed)"
    iTextRow&=INT(.9*numRows&)
    iTextCol&=INT(.1*numRows&)
    COLOR 15,1                                     'PB/CC Color for Print statement
    GfxTextHole  1,iTextCol&,iTextRow&,iTextCol&+LEN(Text2Show$)-1,iTextRow&    'hole for text to peek through graphics screen
    LOCATE iTextRow&,iTextCol&
    PRINT Text2Show$;
    
    GfxWindow %GFX_UNFREEZE                        'now UnFreeze the graphics window to show what you did
    
    '----------------------------------------------------------------------------------------------------------------
    
    DO   '-------------  Do Loop repeats checking pulldown menu until user Exits-------------------------------------
    
        lUserSelection& = PulldownMenu(1, 0, %OFF)           'for Esc, Enter, etc... see Contools Help
    
        SELECT CASE lUserSelection&
         CASE 201    '  Open File= 201
    
         CASE 202    '  Close File=202
    
         CASE 203    '  Exit=203
          EXIT FUNCTION
    
         CASE 301    '  Do something else...=301
    
         CASE 302    '  Do even more....=302
    
         CASE 401    '  Help me &Rhonda=401
           DrawFrom INT(0.4*nXu),INT(0.8*nYu)
           lResult& = DrawTextRow ("Brian Wilson Rules !",%TEXT_RAISED OR %TEXT_ANIMATE)
    
         CASE 402    '  &About=402"
           sText$ ="Raymer's Wrapper: PBCC with Contools & GFX"+CHR$(13)+ _
                   "Copyright C 2008 by D. Raymer, but permission"+CHR$(13)+ _
                   "    hereby given to use this however you wish"+CHR$(13)+ _
                   "Disclaimer - use at your own risk, no promises"+CHR$(13)+ _
                   "    or guarantees are offered !"+CHR$(13)
           sTitle$="Raymer's Wrapper Message Box"
           lResult& = ConsoleMessageBox(" "+sText$,%OKONLY,sTitle$,0,%false)
    
        END SELECT
        
    LOOP             'End of Pulldown Do Loop
    
    END FUNCTION
    '----------------------------------------------------------------------------------------------------------

    Leave a comment:


  • Michael Mattias
    replied
    ...my small example doesn't have the problem, but my 7,000+ line big program does. I'll cut & paste from big to small ....
    I'll bet you four dollars nineteen cents Eric wouldn't mind at all if you sent him a zipped-up source and executable of that 7,000 line program... if that's the program which exhibits the behavior.

    Leave a comment:


  • Daniel Raymer
    replied
    Working on source code example

    Eric - I'm working on it. So far my small example doesn't have the problem, but my 7,000+ line big program does. I'll cut & paste from big to small until small is bad like big.

    Thanks for your help.

    Dan

    Leave a comment:


  • Eric Pearson
    replied
    GfxOption(%GFX_DEFAULT_WINDOW_STYLE) doesn't compile
    Sorry, I meant %GFX_WINDOW_DEFAULT_STYLE.

    You say that the graphics window is being given scroll bars if you maximize or Alt-Tab the console window. Are you sure that the scroll bars aren't part of the console window?

    Can you simply send me the source code for a small but compilable program that does not behave the way you expect?

    -- Eric

    Leave a comment:


  • Daniel Raymer
    replied
    Scrollbars still happening

    Eric,

    GfxOption(%GFX_DEFAULT_WINDOW_STYLE) doesn't compile. Did you mean something else to make GFX_STYLE_SCROLLBARS_NEVER work with ConsoleGfx ?

    I did find that the unwanted scrollbars happen if you do ConsoleWindow %MAXIMIZE any time after ConsoleGFX in the code posted above (my reworking of Stretch.BAS). Getting rid of all those "fixed" the problem, but if I Alt-Tab out of my program then back in, the scrollbars appear and won't go away.

    Some way of activating SCROLLBARS_NEVER would be very nice !

    Leave a comment:


  • Eric Pearson
    replied
    The Windows Toolbar is hidden.
    Technically it's the Windows Task Bar that is hidden. A console Toolbar is present only on Win 9x and ME console windows. I point this out because if you try to use functions like ConsoleMetrics(%TOOLBAR_HEIGHT) the results won't be pertinent to the problem you need to solve.

    The ConsoleInfo function will provide all of the values you need, including "the size of the desktop minus the Task Bar".

    Also, this Window is mean - you can't Alt-Tab to other Windows.
    That's exactly what I meant by "it is quite aggressive at keeping the console visible". The goal of the Stretch.BAS program is to stretch the console window to fill the entire screen, and to keep it that way until the program exits. (Much like an Alt-Enter fullscreen console, but with a title bar and the ability to draw graphics.)

    I rem'd out ConsoleTopMost %TRUE which seems to work, but will that mess up anything else?
    No, in fact I'd encourage you to experiment with removing other items, like ConsoleToForeground and ConsoleStretch. All you really need is the comprehensive size-calculation stuff.

    I find that my GFX window has scrollbars which I don't want or need. I open a graphics window using ConsoleGfx 0,0,0,0 so that it completely fills the console.
    Hmm, it's possible that you need to delay for a short time between resizing the console and creating the graphics window. Windows often provides "outdated" values for second or so after an operation like changing the console size. If you add SLEEP 2000 just before ConsoleGfx 0,0,0,0 and you still get graphics-window scroll bars, I'll need to see some code.

    I tried killing the scrollbars using GFX_STYLE_SCROLLBARS_NEVER but GfxOption won't take that option, and ConsoleGFX has no style option.
    It does, but it's indirect. Use GfxOption(%GFX_DEFAULT_WINDOW_STYLE) and then call ConsoleGfx.

    -- Eric

    Leave a comment:


  • Daniel Raymer
    replied
    But now there are scrollbars on GFX

    After using the Stretch code as described in my last post, I find that my GFX window has scrollbars which I don't want or need. I open a graphics window using ConsoleGfx 0,0,0,0 so that it completely fills the console.

    I tried killing the scrollbars using GFX_STYLE_SCROLLBARS_NEVER but GfxOption won't take that option, and ConsoleGFX has no style option.


    Code:
    ...right after console setup
    ConsoleGfx 0,0,0,0   
    GfxCLS

    Leave a comment:


  • Daniel Raymer
    replied
    Problem solved by accident ?

    Hold the presses - I just notice that when I rem'd out ConsoleTopMost %TRUE, the Windows toolbar showed up. Problem solved? Or is there another problem not obvious to me?

    Leave a comment:


  • Daniel Raymer
    replied
    Tried with Stretch.Bas code - close, but not quite...

    Thanks Eric,
    I copied in stuff from Stretch (see below) and that does the trick, but a little too well. The Windows Toolbar is hidden. Comments in Stretch imply that this is fixable, but I don't see how to return the height of the toolbar (ConsoleMetrics ?).

    Also, this Window is mean - you can't Alt-Tab to other Windows. I rem'd out ConsoleTopMost %TRUE which seems to work, but will that mess up anything else?

    And, thanks for your time!

    Code:
    #REGISTER NONE
    #INCLUDE "C:\PBCC40\Winapi\WIN32API.INC"     'should be newest one!
    #INCLUDE "c:\GFXTOOLS\GFXT_Pro.INC"           'upgrade to version 2
    #INCLUDE "c:\CONTOOLS\CT_Pro.INC"             'update to version 2.50
    %MAXMENUBUFFER=100
    
    FUNCTION WINMAIN(BYVAL hCurInstance  AS LONG, BYVAL hPrevInstance AS LONG, _
                          BYVAL lpszCmdLine AS ASCIIZ PTR, BYVAL nCmdShow AS LONG) EXPORT AS LONG
    
            'these needed for console sizing - from Stretch.bas
        DIM spXSize AS LOCAL SINGLE
        DIM spYSize AS LOCAL SINGLE
        DIM lRow AS LOCAL LONG
    
    ConsoleToolsAuthorize <<your code>>
    lResult& = InitConsoleTools(hCurInstance, %MAXMENUBUFFER, 2, 3, 0, 0) ' 2 screen save buffers ; 3=using new GFX-Pro
    
    '----from stretch.bas-----------
        ConsoleWindow %RESTORE
        spXSize = ConsoleInfo(%SCREEN_WIDTH) / ConsoleMetrics(%COL_WIDTH)
        spYSize = ConsoleInfo(%SCREEN_HEIGHT)
            'We don't want to use the entire space. Leave room for
            'the title bar.  (This code could be modified to leave
            'room for the Toolbar.)
            spYSize = spYSize - ConsoleMetrics(%TITLEBAR_HEIGHT) - ConsoleMetrics(%FRAME_HEIGHT)
        spYSize = spYSize / ConsoleMetrics(%ROW_HEIGHT)
        ConsoleControl %BUFFER_WIDTH,  CEIL(spXSize)
        ConsoleControl %BUFFER_HEIGHT, CEIL(spYSize)
    '    ConsoleTopMost %TRUE
        ConsoleStretch
        ConsoleToForeground %SOFT
        ConsoleMove 0-ConsoleMetrics(%FRAME_WIDTH)-ConsoleMetrics(%BORDER_SIZE), _
                        0-ConsoleMetrics(%FRAME_HEIGHT)
    '-------------------------  end of stretch stuff
    
    SLEEP 25                     'PBCC from WinAPI (in milliseconds) let console finish initializing before continuing
    PRINT
    PRINT "  press any key to exit"
    WAITKEY$
    END FUNCTION

    Leave a comment:


  • Eric Pearson
    replied
    You are calculating the desired height (dum!) in a way that leaves out a few factors. I'd recommend looking at the Stretch.BAS example program that comes with Console Tools; it handles all of the issues, as far as we know. It does cover up the task bar, and it is quite aggressive at keeping the console visible, but a stripped-down version of that program will do exactly what you need.

    -- Eric

    Leave a comment:


  • Daniel Raymer
    replied
    Bottom trick

    Thanks Eric. On my machine the right side is pretty close to the edge, but the bottom is far from the available bottom. It looks like there is room for 3 or 4 more rows. Is there a trick to get it closer to the taskbar?

    Leave a comment:


  • Eric Pearson
    replied
    on my two computers it doesn't quite go to the right or to the bottom
    You are seeing a limitation of console windows, not your code, Console Tools, or PBCC. Windows will only allow the creation of consoles with integer numbers of text rows and columns. Depending on the console font size, desktop resolution, and other factors, it may not be possible to "perfectly" fill the desktop with a console. A specific example...

    On my 800x600 test system, your program creates a console window that comes within 4 pixels of filling the desktop from left to right, i.e. the console window is 796 pixels wide. I am using an 8x12 console font, so adding another column of text would require the addition of 8 pixels, which would create a console window that is 796+8=804 pixels, which is too wide to fit on the screen... so Windows automatically makes it smaller and adds scroll bars. Exactly the same thing is happening with the console height.

    -- Eric Pearson, Perfect Sync, Inc.

    Leave a comment:


  • Daniel Raymer
    started a topic Contools - won't fill screen

    Contools - won't fill screen

    Using Contools - love it - but can't figure out how to make the console as big as possible without covering the Start & Taskbar at the bottom of Windows. I don't want to Maximize the display, just almost maximize! This code is close, but on my two computers it doesn't quite go to the right or to the bottom, by about 10% of the screen.

    Code:
    #REGISTER NONE
    #INCLUDE "C:\PBCC40\Winapi\WIN32API.INC"     'should be newest one!
    #INCLUDE "c:\GFXTOOLS\GFXT_Pro.INC"           'upgrade to version 2
    #INCLUDE "c:\CONTOOLS\CT_Pro.INC"             'update to version 2.50
    %MAXMENUBUFFER=100
    
    FUNCTION WINMAIN(BYVAL hCurInstance  AS LONG, BYVAL hPrevInstance AS LONG, _
                          BYVAL lpszCmdLine AS ASCIIZ PTR, BYVAL nCmdShow AS LONG) EXPORT AS LONG
    
    ConsoleToolsAuthorize <<<your code>>>           'Authorization code 
    lResult& = InitConsoleTools(hCurInstance, %MAXMENUBUFFER, 2, 3, 0, 0) ' 2 screen save buffers ; 3=using new GFX-Pro
    lResult& = Console80x(30)   ' sets 80 col, 30 row console (helps size on other systems)
    
    '-----------should completely maximizes window to fill desktop (less toolbar)from initial values
     dum!=ConsoleInfo(%DESKTOP_HEIGHT)/ConsoleInfo(%WINDOW_HEIGHT)
     dum!=FIX(dum!*ConsoleInfo(%BUFFER_HEIGHT))
     dum2!=ConsoleInfo(%DESKTOP_WIDTH)/ConsoleInfo(%WINDOW_WIDTH)
     dum2!=FIX(dum2!*ConsoleInfo(%BUFFER_WIDTH))
     lResult& = ConsoleControl(%BUFFER_HEIGHT,dum!)
     lResult& = ConsoleControl(%CONSOLE_BOTTOM,dum!)
     lResult& = ConsoleControl(%BUFFER_width,dum2!)
     lResult& = ConsoleControl(%CONSOLE_right,dum2!)
     lResult& = ConsoleMove(0,0)  'left side of screen at pixel 0,
     SLEEP 25                     
    
    PRINT
    PRINT "  press any key to exit"
    WAITKEY$
    END FUNCTION
Working...
X
😀
🥰
🤢
😎
😡
👍
👎