Page 2 sur 2

Re: Redefinir les options d'une fenêtre

Publié : lun. 18/avr./2011 20:23
par Le Soldat Inconnu
alors il faut peut-être masquer la fenêtre, la modifier et réafficher la fenêtre. Est-ce mieux ?

Code : Tout sélectionner

    ;- Window Constants
    ;
    Enumeration
			#Window_0
		EndEnumeration
		
		
		
    If OpenWindow(#Window_0, 0, 0, 600, 300, "Ma fenêtre",  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
			
			ButtonGadget(0, 5, 5, 290, 25, "Retirer la bordure")
			ButtonGadget(1, 305, 5, 290, 25, "Remettre la bordure")
			ButtonGadget(2, 5, 35, 290, 25, "Retirer le bouton minimiser")
			ButtonGadget(3, 305, 35, 290, 25, "Remettre le bouton minimiser")
			ButtonGadget(4, 5, 65, 290, 25, "Retirer le bouton maximiser")
			ButtonGadget(5, 305, 65, 290, 25, "Remettre le bouton maximiser")
			
			Repeat ; Start of the event loop
				
				Event = WaitWindowEvent() ; This line waits until an event is received from Windows
				
				WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
				
				;You can place code here, and use the result as parameters for the procedures
				
				If Event = #PB_Event_Gadget
					GadgetID = EventGadget() ; Is it a gadget event?
					EventType = EventType() ; The event type
					Select GadgetID
						Case 0
							HideWindow(#Window_0, 1)
							; On récupère le style de la fenêtre
							Style = GetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE)
							; On modifie le style
							SetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE, Style & ~#WS_TILEDWINDOW)
							HideWindow(#Window_0, 0)
							UpdateWindow_(WindowID(#Window_0))
							
						Case 1
							HideWindow(#Window_0, 1)
							; On récupère le style de la fenêtre
							Style = GetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE)
							; On modifie le style
							SetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE, Style | #WS_TILEDWINDOW)
							HideWindow(#Window_0, 0)
							UpdateWindow_(WindowID(#Window_0))
							
						Case 2
							HideWindow(#Window_0, 1)
							; On récupère le style de la fenêtre
							Style = GetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE)
							; On modifie le style
							SetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE, Style & ~#WS_MINIMIZEBOX)
							HideWindow(#Window_0, 0)
							UpdateWindow_(WindowID(#Window_0))
							
						Case 3
							HideWindow(#Window_0, 1)
							; On récupère le style de la fenêtre
							Style = GetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE)
							; On modifie le style
							SetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE, Style | #WS_MINIMIZEBOX)
							HideWindow(#Window_0, 0)
							UpdateWindow_(WindowID(#Window_0))
							
						Case 4
							HideWindow(#Window_0, 1)
							; On récupère le style de la fenêtre
							Style = GetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE)
							; On modifie le style
							SetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE, Style & ~#WS_MAXIMIZEBOX)
							HideWindow(#Window_0, 0)
							UpdateWindow_(WindowID(#Window_0))
							
						Case 5
							HideWindow(#Window_0, 1)
							; On récupère le style de la fenêtre
							Style = GetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE)
							; On modifie le style
							SetWindowLongPtr_(WindowID(#Window_0), #GWL_STYLE, Style | #WS_MAXIMIZEBOX)
							HideWindow(#Window_0, 0)
							UpdateWindow_(WindowID(#Window_0))
							
					EndSelect
				EndIf
				
			Until Event = #PB_Event_CloseWindow ; End of the event loop
			
		EndIf

Re: Redefinir les options d'une fenêtre

Publié : lun. 18/avr./2011 21:29
par Kwai chang caine
Bravo soldat....ça marche pour moi, merci 8)

Re: Redefinir les options d'une fenêtre

Publié : mar. 19/avr./2011 16:37
par MLD
Excuse du retard soldat.
Maintenant tous est OK

Re: Redefinir les options d'une fenêtre

Publié : mer. 20/avr./2011 13:54
par dayvid
Ouais nikel :)
merci :D

Re: Redefinir les options d'une fenêtre

Publié : jeu. 31/janv./2013 15:13
par Ar-S
Je réouvre ce topic car le soucis de 'disparition' du gadget perdure.
Avec ton dernier code LSI, le bouton maximise ne disparait pas, il se desactive seulement. Idem pour minimiser.
Il ni a qu'en desactivant les 2 qu'ils disparaissent, or, je souhaiterai que ma barre comporte la croix et le bouton minimiser seulement.
As tu (y'a t il) une solution (windows 8 ) ?

Re: Redefinir les options d'une fenêtre

Publié : mer. 13/févr./2013 15:47
par XD73
Bonjour,

Je ne crois pas que ce soit possible, le comportement me semble "Normal"
Cordialement.