Procedure LimitWindow()

AmigaOS specific forum
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Roxxler.

Hi,

hier eine kleine Procedure, welche die Minimalgröße sowie
Maximalgröße eines Fenster neu setzt. Man kann das auch
über Taglists erreichen, ich weiß, finde es so einfacher.

here a little procedure which allows to change the min size
and also the max size of a window. I know that this can do
also via Taglists but this way is easier for me.

Procedure.b LimitWindow(fensterid.l,minbreite.w,minhoehe.w,maxbreite.w,maxhoehe.w)
;
; Das Unterprogramm legt die Minimal- sowie Maximalgröße des angegebenen
; Fensters neu fest. Danach kann das Fenster nur noch innerhalb dieser
; Werte verändert werden.
; Beispiel:
; UseWindow(2)
; LimitWindow(WindowID(),100,50,400,250) ; Fenster 2 kann nur innerhalb dieser
; Werte in der Größe verändert werden.
;
; With this procedure you can change the min and max size of the given
; window. After that you can size the window only in the given dimension.
; Example:
; UseWindow2()
; LimitWindow(WindowID(),100,50,400,250) ; window 2 can only size between the given dimension
;
; Parameter: fensterid.l = Die Adresse des Fensters (ermittelt von WindowID())
; The address of the window structure (given from WindowID())
;
; minbreite.w = Minimale Breite des Fenster in Pixel.
; Wird 0 angegeben dann bleibt der bisherige Wert unverändert.
; min width of the window
; if 0 then the existing min width will be not touched
; minhoehe.w = Minimale Höhe des Fensters in Pixel.
; Wird 0 angegeben dann bleibt der bisherige Wert unverändert.
; min height of the window
; if 0 then the existing min height will be not touched
; maxbreite.w = Maximale Breite des Fensters in Pixel.
; Wird 0 angegeben dann bleibt der bisherige Wert unverändert.
; Wird -1 angegeben dann kann das Fenster auf maximale
; Screenbreite vergrößert werden.
; max width of the window
; if 0 then the existing max width will be not touched
; if set to -1 you can size width the window to full screen width
; maxhoehe.w = Maximale Höhe des Fensters in Pixel.
; Wird 0 angegeben dann bleibt der bisherige Wert unverändert.
; Wird -1 angegeben dann kann das Fenster auf maximale
; Screenhöhe vergrößert werden.
; max height of the window
; if 0 then the existing max height will be not touched
; if set to -1 you can size the window to full screen height
;
; Rückgabe : TRUE = -1 = Alle Werte neu gesetzt, alles ok.
; everything went fine
; Returns : FALSE = 0 = Ein oder mehrere Werte sind inkorrekt; kein Wert wurde neu gesetzt.
; Dies kann z.B. passieren wenn die Werte minbreite und minhoehe
; größer sind als das Fenster derzeit selbst breit und hoch ist.
; Alle Werte müssen sich also im erlaubten und logischen Bereich
; befinden.
; One or more of the given parameter are not correct. In this
; case no changes will do. This happens e.g. if the new minwidth
; and new minheight are greater than the window itself. All parameters
; have to be in a logical and allowed range.
;
; Voraussetzungen: Die Intuition.library muß geöffnet sein (OpenIntuitionLibrary_(version)).
; Wird von PureBasic am Programmende wieder geschlossen.
; Requirements : You have to open the intuition.library (OpenIntuitionLibrary_(version).
; PureBasic will close the lib automatically at the program end.
;
; Hinweis : Es kann unter Umständen ein wenig Zeit vergehen bis Intuition von der
; Änderung informiert wird und eine Nachricht davon erhält (etwa 10x in
; der Sekunde erhält Intuition eine solche).
; Note : It can be take a little bit time until Intuition will receive a message
; about the change. Normally Intuition will receive 10x per seconds a
; message about changes.

ok.b=WindowLimits_(fensterid,minbreite,minhoehe,maxbreite,maxhoehe)
ProcedureReturn ok
EndProcedure

Greetings
Roxxler