Hello Justin,
I found the cause of the problem. It is related to the restructuring of the Win32 build environment we made same time ago. So there are more variables to take in account. Additionally the scrollbar support has to be disabled. Please follow the steps below:
1. Revert all your modifications in the Build Environment. The best is, you download a complete new, fresh version of the Windows Build Environment.
2. In the Build Environment locate the file Application\Source\ewmain.c.
3. Add following new function to the end of the file:
/* Following function has the job to adjust the size of the viewport and the
of the root object to the values provided in the variables aWidth/aHeight. */
void EwResizeScreen( int aWidth, int aHeight, void* aFrameBuffer )
{
XPoint size = { aWidth, aHeight };
XRect rect = { 0, 0, aWidth, aHeight };
/* Each time the window is resized -> discard the old viewport ... */
if ( Viewport ) EwDoneViewport( Viewport );
Viewport = 0;
/* ... and create a new viewport as bridge between the Windows DIB and the
Graphics Engine bitmap represented by aFrameBuffer */
if (( Viewport = EwInitViewport( size, rect, 0, 255, aFrameBuffer,
0, 0, EwViewportProc )) == 0 )
EwPanic();
/* Update all relevant variables */
DisplayInfo.FrameBuffer = aFrameBuffer;
DisplayInfo.DisplayWidth = aWidth;
DisplayInfo.DisplayHeight = aHeight;
DisplayInfo.ViewportX = 0;
DisplayInfo.ViewportY = 0;
DisplayInfo.ViewportWidth = aWidth;
DisplayInfo.ViewportHeight = aHeight;
DisplayInfo.Context = 0;
/* update the size of the root object */
CoreRectView__OnSetBounds( RootObject, rect );
CoreGroup__InvalidateArea( RootObject, rect );
}
4. In the Build Environment locate the file Application\Source\gfx_system_windows.c.
5. In this file search for case WM_HSCROLL. Remove the entire case code block, since we don't need scrollbars anymore.
6. In this file search for case WM_VSCROLL. Remove the entire case code block, since we don't need scrollbars anymore.
7. In this file search for case WM_GETMINMAXINFO. Replace the code block by following implementation. In this implementation specify your desired min. size of the window (in the variables minWidth and minHeight). At the runtime, the window will be restricted to not become smaller:
/* Ensure, the size of the viewer window doesn't exceed the given min. value */
case WM_GETMINMAXINFO :
{
MINMAXINFO* mmi = (MINMAXINFO*)aLParam;
RECT rect = { 0, 0, 200, 200 };
/* The min. size of the GUI application */
int minWidth = 200;
int minHeight = 100;
/* Estimate, how thick are the border and the title bar of the window? */
AdjustWindowRectEx( &rect, WS_OVERLAPPEDWINDOW, 0, WS_EX_CLIENTEDGE );
/* Limit the min. window size accordingly. Take in account the thickness of
the border and of the title bar */
mmi->ptMinTrackSize.x = minWidth + (( rect.right - rect.left ) - 200 );
mmi->ptMinTrackSize.y = minHeight + (( rect.bottom - rect.top ) - 200 );
}
break;
7. Search for case WM_SIZE. Replace the code block by following implementation:
/* In response to WM_SIZE adjust the size of the GUI application */
case WM_SIZE :
{
extern void EwResizeScreen( int aWidth, int aHeight, void* aFrameBuffer );
int width = LOWORD( aLParam );
int height = HIWORD( aLParam );
/* Any size changes? */
if (( width != ViewerSize.X ) || ( height != ViewerSize.Y ))
{
/* Each time the window is resized -> free the old framebuffer */
if ( FrameBuffer ) DestroyDib( FrameBuffer );
FrameBuffer = 0;
/* Create new framebuffer */
if (( FrameBuffer = CreateDib( width, height )) == 0 )
{
EwPrint( "ERROR: Failed to create a framebuffer.\n" );
EwPanic();
}
/* Remember the new size in the global variables */
ViewerSize.X = width;
ViewerSize.Y = height;
/* Finally re-create the viewport and update the bounds of the root object. */
EwResizeScreen( width, height, FrameBuffer );
}
}
break;
I hope this helps you further. We will discuss internally to eventually add this 'dynamic resizing' feature to the Windows Build Environment in the next version.
Best regards
Paul Banach