ResizeWindow halting

Just starting out? Need help? Post your questions and find answers here.
Phant0m``

ResizeWindow halting

Post 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.
Phant0m``

Post by Phant0m`` »

Nice to know i'm not the only one... :wink:
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

I'll join the queue waiting for this answer. Anything I've tried gets lousy jerky results - basically fights with the user.

:)
Phant0m``

Post by Phant0m`` »

:lol:
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post 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?
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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)
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

That would be neat. :)

Um

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

:?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

LimitWindowSize()

CapWindow()

WindowSizeLimit()

SetWindowSizeLimits()

SetWindowLimits()

MakeSureTheWindowIsNotGettingTooBigOrTooSmallYouWimpWhoCannotCodeThisYourself()

... to name but a few :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Kris_a
User
User
Posts: 92
Joined: Sun Feb 15, 2004 8:04 pm
Location: Manchester, UK

Post by Kris_a »

"WindowSizeLimit" has a ring to it, dont you think? or maybe "SetWindowSizeLimit / GetWindowSizeLimit"

(whoops, you beat me to it Blueznl :D)
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

MakeSureTheWindowIsNotGettingTooBigOrTooSmallYouWimpWhoCannotCodeThisYourself()

Suits me. :D

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

Post 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
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

SetWindowSize() ?

btw: MaximizeWindow(#flag) and IsMaxizmizeWindow() would be nice...
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

SetWindowMaxMinSize()?

or

SetWindowMinMaxSize() ;)
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Thanks for the suggestions ! what about WindowBounds() (ok, I got that from JAVA ;)).
Post Reply