Page 1 of 2

ResizeWindow halting

Posted: Sun Apr 18, 2004 5:30 pm
by Phant0m``
Hey folks

I’ve been looking everywhere and I couldn’t find nothing that worked, so once again I bring my questions to the forum.

I have Window that I want resized, but not resized any smaller then the default Window size, but not prevent the Window from being resized bigger.

Now using

Code: Select all

Repeat 
     EventID = WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow 
I was capable of using ResizeWindow() command but the only problem is while forcing the window smaller then the default size, it flickers, bounces… I simply want the resizing to smaller size then the Default Window size halted on spot, if I’m not mistaking I think using SetWindowCallback() is probably low enough level to-do that but I’m clueless where to start. In addition I’m already using SetWindowCallback() command for Column sorting and when I try to implement there is a conflict which prevents Column Sorting from functioning.

Posted: Mon Apr 19, 2004 2:12 pm
by Phant0m``
Nice to know i'm not the only one... :wink:

Posted: Mon Apr 19, 2004 2:22 pm
by Dare2
I'll join the queue waiting for this answer. Anything I've tried gets lousy jerky results - basically fights with the user.

:)

Posted: Mon Apr 19, 2004 2:29 pm
by Phant0m``
:lol:

Posted: Mon Apr 19, 2004 2:35 pm
by freak
Here you go:

Code: Select all

;
; Max/Min Window size tracking..
;

Procedure SizeCallback(WindowID, Message, wParam, lParam)
 
  ; Here is the trick. The GETMINMAXINFO must be processed
  ; and filled with min/max values...
  ;
  If Message = #WM_GETMINMAXINFO
    *SizeTracking.MINMAXINFO = lParam
    *SizeTracking\ptMinTrackSize\x = 100
    *SizeTracking\ptMinTrackSize\y = 100
    *SizeTracking\ptMaxTrackSize\x = 600
    *SizeTracking\ptMaxTrackSize\y = 300
  EndIf
        
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

If OpenWindow(0,10,10,200,200,#PB_Window_SystemMenu | #PB_Window_SizeGadget, "Resize me !")
  SetWindowCallback(@SizeCallback())
       
  Repeat
  Until WaitWindowEvent() = #PB_EventCloseWindow
EndIf
(originally posted by fred ages ago :) )


Phant0m``:
If you allready have another callback, don't set this up as another one,
because you can only have 1 callback procedure at a time.
(So if you add another one, the first won't work anymore)

Instead, just copy the code inside this callback procedure into your
own one. This should work.

Timo

Posted: Mon Apr 19, 2004 2:42 pm
by Dare2
Hi Freak,

Thanks. And to set the maximums:

GetSystemMetrics_(#SM_CXSCREEN)
GetSystemMetrics_(#SM_CYSCREEN)

would be safe bet? This is to the edge of the window, not the edge of the client area?

Posted: Mon Apr 19, 2004 2:54 pm
by Fred
I think I could add a native command for this. Any name suggestion for this ? I can't find a good one:

Code: Select all

SomethingName(#Window, MinWidth, MinHeight, MaxWidth, MaxHeight)

Posted: Mon Apr 19, 2004 3:03 pm
by Dare2
That would be neat. :)

Um

.. DefineWindowSizeLimits(smlW,smlH,bigW,bigH)
.. SetAbsoluteWindowSizing(..)

:?

Posted: Mon Apr 19, 2004 3:05 pm
by blueznl
LimitWindowSize()

CapWindow()

WindowSizeLimit()

SetWindowSizeLimits()

SetWindowLimits()

MakeSureTheWindowIsNotGettingTooBigOrTooSmallYouWimpWhoCannotCodeThisYourself()

... to name but a few :-)

Posted: Mon Apr 19, 2004 3:06 pm
by Kris_a
"WindowSizeLimit" has a ring to it, dont you think? or maybe "SetWindowSizeLimit / GetWindowSizeLimit"

(whoops, you beat me to it Blueznl :D)

Posted: Mon Apr 19, 2004 3:12 pm
by Dare2
MakeSureTheWindowIsNotGettingTooBigOrTooSmallYouWimpWhoCannotCodeThisYourself()

Suits me. :D

Except it takes an hour to type and we wimps make typos! Maybe an alias: WimpSettings()

Posted: Mon Apr 19, 2004 3:38 pm
by Phant0m``
Hey freak

Much appreciated!!!
Thanks a billion!!! :D
freak wrote:Here you go:

Code: Select all

;
; Max/Min Window size tracking..
;

Procedure SizeCallback(WindowID, Message, wParam, lParam)
 
  ; Here is the trick. The GETMINMAXINFO must be processed
  ; and filled with min/max values...
  ;
  If Message = #WM_GETMINMAXINFO
    *SizeTracking.MINMAXINFO = lParam
    *SizeTracking\ptMinTrackSize\x = 100
    *SizeTracking\ptMinTrackSize\y = 100
    *SizeTracking\ptMaxTrackSize\x = 600
    *SizeTracking\ptMaxTrackSize\y = 300
  EndIf
        
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

If OpenWindow(0,10,10,200,200,#PB_Window_SystemMenu | #PB_Window_SizeGadget, "Resize me !")
  SetWindowCallback(@SizeCallback())
       
  Repeat
  Until WaitWindowEvent() = #PB_EventCloseWindow
EndIf
(originally posted by fred ages ago :) )


Phant0m``:
If you allready have another callback, don't set this up as another one,
because you can only have 1 callback procedure at a time.
(So if you add another one, the first won't work anymore)

Instead, just copy the code inside this callback procedure into your
own one. This should work.

Timo

Posted: Mon Apr 19, 2004 4:57 pm
by GPI
SetWindowSize() ?

btw: MaximizeWindow(#flag) and IsMaxizmizeWindow() would be nice...

Posted: Mon Apr 19, 2004 5:25 pm
by Pupil
SetWindowMaxMinSize()?

or

SetWindowMinMaxSize() ;)

Posted: Mon Apr 19, 2004 10:13 pm
by Fred
Thanks for the suggestions ! what about WindowBounds() (ok, I got that from JAVA ;)).