Dan --
In my opinion, you are trying to use a flat-blade when you need a Phillips-head. We can make it work in the short term -- we can tighten this particular screw -- but I foresee additional problems and frustrations ahead.
I'll be glad to discuss this with you, but let's do it by email, ok?
-- Eric Pearson, Perfect Sync, Inc.
Announcement
Collapse
No announcement yet.
PBCC+CONTOOLS/GFX - Scrollbars Problem
Collapse
X
-
PBCC+CONTOOLS/GFX - Scrollbars Problem
For large amounts of data entry I want to make a wider-than-my-screen Console & Graphics Window, with scrollbars. I'm using the GFX text writing functions, and doing my own mouse-over to select which data item to input.
I'm using ConsoleControl %BUFFER_WIDTH with a value larger than the screen, then using ConsoleGfx 0,0,0,0 to make a graphics screen. All seems OK, but if you scroll to the right the graphics background isn't white as it should be, and if you scroll back to the left it gets really screwy.
I'm guessing that somehow I need to paste the Graphics Window to the over-sized console, but I thought ConsoleGfx did that automatically. Suggestions?
Code:'------------------------------------------------------------------------------------------------------------ '***************** Raymer's Wrapper: PBCC with Contools & GFX ********************************* '------------------------------------------------------------------------------------------------------------ #REGISTER NONE #INCLUDE "c:\GFXTOOLS\GFXT_Pro.INC" #INCLUDE "c:\CONTOOLS\CT_Pro.INC" %MAXMENUBUFFER=100 DECLARE FUNCTION PrintText2Console(sText$,iTextRow&,iTextCol&,iHoleNumber&) AS LONG DECLARE FUNCTION INPUTBOX1$(sPrompt$,sDefault$,sTitle$) AS STRING 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&= xxxxxxx '<<<< 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, 2*INT(spXSize) 'oversize console width making scrollbars ConsoleControl %BUFFER_HEIGHT, INT(0.95*spYSize) 'needed to make room for scrollbar '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=301 | Do nothing=302" MenuDefinition 4, "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 an image is in the Windows Clipboard, it is displayed)" iTextRow&=INT(.9*numRows&) iTextCol&=INT(.1*numCols&) iHoleNumber&=1 'see note on holes in PrintText2Console Function below COLOR 15,1 'PB/CC Color for Print statement PrintText2Console(Text2Show$,iTextRow&,iTextCol&,iHoleNumber&) 'Print Function coded below: sText$,iTextRow&,iTextCol&,iHoleNumber 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 =301 sResult$ = INPUTBOX1$("Enter Text to Do Something","867-5309","Raymer Wrapper Input Box") IF sResult$<>"CANCEL" THEN Text2Show$="You entered: "+sResult$ iTextRow&=INT(.95*numRows&) iTextCol&=INT(.1*numCols&) iHoleNumber&=2 PrintText2Console(Text2Show$,iTextRow&,iTextCol&,iHoleNumber&) 'Print Function coded below: sText$,iTextRow&,iTextCol&,iHoleNumber END IF CASE 302 ' Do nothing =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 '--------------------------------------------------------------------------------------------------------------- ' Raymer's Wrapper Functions FUNCTION PrintText2Console(sText$,iTextRow&,iTextCol&,iHoleNumber&) AS LONG ' Prints Input String to Console in a new Hole created through the graphics window ' if you reuse a hole number, the text in the old location of that hole will probably be covered up ' later fill in holes using: FillHole iHoleNumber& ' max of 32 holes unless increased using: GfxOption GFX_MAX_HOLES GfxTextHole iHoleNumber&,iTextCol&,iTextRow&,iTextCol&+LEN(sText$)-1,iTextRow& LOCATE iTextRow&,iTextCol& PRINT sText$; GfxRefresh 1 FUNCTION=0 END FUNCTION FUNCTION INPUTBOX1$(sPrompt$,sDefault$,sTitle$) ' 1 line - RETURNS: sResult$ = INPUTBOX1$(sPrompt$,sDefault$,sTitle$) sResult$ = ConsoleInputBox(3+%TOPMOST,%Center,0.15*nYp,sPrompt$,sTitle$,sDefault$,0,%false) ConsoleFocus 'returns window focus to console if user clicks on progress box, etc... IF ConsoleInputBoxCancel THEN FUNCTION = "CANCEL" ELSE FUNCTION = sResult$ END IF END FUNCTION
Tags: None
-
Leave a comment: