WindowMaker
-
- Messages : 1501
- Inscription : dim. 18/avr./2004 15:04
- Localisation : sud de la france
Re: WindowMaker
et davyd c'est suffit d'etudier le code comme je le veux en ce moment afin d'apporter une touche perso .
Jbernard13
Re: WindowMaker
J'ai fait une nouvelle version de mon "Window Maker"
J'ai ajouté une fenêtre pour prévisualiser le résultat
J'ai modifié le code, je passe maintenant par des structures.
On peut modifier la taille de la fenêtre de prévisualisation et ses dimensions mini/maxi en entrant les valeurs dans les StringGadgets.
Les touches "Entrée" et "Tab" permettent de valider la valeur saisie et de passer au string suivant.
Dobro, si tu veux le mettre dans ton EPB...
J'ai ajouté une fenêtre pour prévisualiser le résultat
J'ai modifié le code, je passe maintenant par des structures.
On peut modifier la taille de la fenêtre de prévisualisation et ses dimensions mini/maxi en entrant les valeurs dans les StringGadgets.
Les touches "Entrée" et "Tab" permettent de valider la valeur saisie et de passer au string suivant.
Dobro, si tu veux le mettre dans ton EPB...
Code : Tout sélectionner
;{- Enumerations
Enumeration
#Window_Main
#Window_Test
EndEnumeration
Enumeration
#CheckBox_SystemMenu
#CheckBox_MinimizeGadget
#CheckBox_MaximizeGadget
#CheckBox_SizeGadget
#CheckBox_Invisible
#CheckBox_TitleBar
#CheckBox_BorderLess
#CheckBox_Tool
#CheckBox_ScreenCentered
#CheckBox_WindowCentered
#CheckBox_Maximize
#CheckBox_Minimize
#CheckBox_NoGadgets
#CheckBox_Smart
#CheckBox_Bound
#CheckBox_Loop
#Button_OnPlace
#Button_Cancel
#Button_NewTab
#String_W
#String_H
#String_X
#String_Y
#String_WindowIdent
#String_Bound_W_Mini
#String_Bound_H_Mini
#String_Bound_W_Maxi
#String_Bound_H_Maxi
#String_Titre
#Edit_Code
#Frame3D_Attributs
#Frame3D_Taille
#Frame3D_Constante
#Frame3D_TailleBound
#Frame3D_Action
#Frame3D_Titre
#Frame3D_Options
#Frame3D_Loop
#Text_Taille
#Text_Position
#Text_Largeur
#Text_Hauteur
#Text_PosX
#Text_PosY
#Text_TailleMin
#Text_TailleMax
#Text_LargeurMin
#Text_HauteurMin
#Text_LargeurMax
#Text_HauteurMax
EndEnumeration
Enumeration
#Font
EndEnumeration
;}
;{- Structures, Listes, Tableaux
Structure WININFO ;/ Infos générales concernant la fenêtre
; Infos générales
WinTitle.s ; Titre de le fenêtre
WinId.s ; Id de le fenêtre
; Position et Taille de la fenêtre
X_Win.l ; Position X fenêtre
Y_Win.l ; Position Y fenêtre
W_Win.l ; Largeur fenêtre
H_Win.l ; Hauteur fenêtre
; Cases à cocher des options additionnelles
WinBound.b ; WindowBound : Actif/Non actif
WinSmart.b ; SmartRefresh: Actif/Non actif
; Valeurs des paramètres "Bound"
BndMin_W.l ; Largeur Mini de la fenêtre
BndMin_H.l ; Hauteur Mini de la fenêtre
BndMax_W.l ; Largeur Maxi de la fenêtre
BndMax_H.l ; Hauteur Maxi de la fenêtre
EndStructure
Structure WINPARAMS ;/ Infos concernant les paramètres
; Cases à cocher des paramètres
l_Param.l ; Paramètres (Valeur)
s_Param.s ; Paramètres (Chaine)
Check.b ; Paramètre : Actif/Non Actif
EndStructure
Global NewList WinParams.WINPARAMS()
Global Info.WININFO
Global T.l
;{/ Lecture et chargement des Datas dans le liste
Restore ParamText
For i = 0 To 12
AddElement(WinParams())
Read.s a$ : WinParams()\s_Param = a$
Next
Restore ParamLong
For i = 0 To 12
SelectElement(WinParams(), i)
Read.l a : WinParams()\l_Param = a
Next ;}
;{/ Initialisation des infos générales
Info\WinTitle = "My Window"
Info\WinId = "#MyWin"
Info\X_Win = 0
Info\Y_Win = 0
Info\W_Win = 400
Info\H_Win = 400
Info\WinBound = 0
Info\WinSmart = 0
Info\BndMin_W = #PB_Ignore
Info\BndMin_H = #PB_Ignore
Info\BndMax_W = #PB_Ignore
Info\BndMax_H = #PB_Ignore
;}
;}
;{- Variables globales
Global PosX.w, PosY.w
Global Font.l
Global RunOneWin = FindWindow_(@"WindowClass_0", @"jaPBe-RunOneWindow")
;}
;{- Constantes spéciales
;/ Constantes utilisées pour le transfert sous jaPBe
#WMCD_OpenFile = 1 ; Ouvre un fichier dans une nouvelle page
#WMCD_InsertText = 2 ; Insère le texte à la position du curseur.
#wmCD_ReplaceCompleteText = 3 ; Remplace la totalité du texte
#wmcd_ReplaceCurrentLine = 4 ; Remplace la ligne ou se trouve le curseur
#wmcd_NewText = 5 ; Ouvre un nouvel onglet, et lui passe le texte
;}
;{- Procedures
Procedure GadgetBalloonToolTip(WindowNumber.l, GadgetNumber.l, Text.s)
Protected Tooltip.l, Balloon.TOOLINFO
Tooltip = CreateWindowEx_(0, "ToolTips_Class32", "", #WS_POPUP | #TTS_NOPREFIX | #TTS_BALLOON, 0, 0, 0, 0, WindowID(WindowNumber), 0, GetModuleHandle_(0), 0)
SendMessage_(Tooltip, #TTM_SETTIPTEXTCOLOR, GetSysColor_(#COLOR_INFOTEXT), 0)
SendMessage_(Tooltip, #TTM_SETTIPBKCOLOR, GetSysColor_(#COLOR_INFOBK), 0)
SendMessage_(Tooltip, #TTM_SETMAXTIPWIDTH, 0, 180)
Balloon\cbSize = SizeOf(TOOLINFO)
Balloon\uFlags = #TTF_IDISHWND | #TTF_SUBCLASS
If IsGadget(GadgetNumber)
Balloon\hwnd = GadgetID(GadgetNumber)
Balloon\uId = GadgetID(GadgetNumber)
Else
Balloon\hwnd = GadgetNumber
Balloon\uId = GadgetNumber
EndIf
Balloon\lpszText = @Text
SendMessage_(Tooltip, #TTM_ADDTOOL, 0, @Balloon)
ProcedureReturn Tooltip
EndProcedure
Procedure ChangeGadgetBalloonToolTip(Tooltip.l, GadgetNumber.l, Text.s)
Protected Balloon.TOOLINFO
Balloon\cbSize = SizeOf(TOOLINFO)
Balloon\uFlags = #TTF_IDISHWND | #TTF_SUBCLASS
If IsGadget(GadgetNumber)
Balloon\hwnd = GadgetID(GadgetNumber)
Balloon\uId = GadgetID(GadgetNumber)
Else
Balloon\hwnd = GadgetNumber
Balloon\uId = GadgetNumber
EndIf
Balloon\lpszText = @Text
SendMessage_(Tooltip, #TTM_ADDTOOL, 0, @Balloon)
EndProcedure
Procedure FreeBalloonTooltip(Tooltip.l)
DestroyWindow_(Tooltip.l)
EndProcedure
Procedure OpenWin_Main()
If OpenWindow(#Window_Main, PosX, PosY, 465, 465, "WindowMaker v2.0", #PB_Window_Tool|#PB_Window_SystemMenu|#PB_Window_SizeGadget)
WindowBounds(#Window_Main, 465, 465, #PB_Ignore, 600)
StickyWindow(#Window_Main, 1)
Font = LoadFont(#Font, "Courrier", 8, #PB_Font_HighQuality|#PB_Font_Bold)
;{/ Gadgets qu'on peut cliquer dedans
CheckBoxGadget(#CheckBox_SystemMenu, 15, 80, 100, 20, "SystemMenu")
CheckBoxGadget(#CheckBox_MinimizeGadget, 15, 105, 100, 20, "MinimizeGadget")
CheckBoxGadget(#CheckBox_MaximizeGadget, 15, 130, 100, 20, "MaximizeGadget")
CheckBoxGadget(#CheckBox_SizeGadget, 15, 155, 100, 20, "SizeGadget")
CheckBoxGadget(#CheckBox_Invisible, 15, 180, 100, 20, "Invisible")
CheckBoxGadget(#CheckBox_TitleBar, 15, 205, 100, 20, "TitleBar")
CheckBoxGadget(#CheckBox_BorderLess, 15, 230, 100, 20, "BorderLess")
CheckBoxGadget(#CheckBox_Tool, 120, 80, 100, 20, "Tool")
CheckBoxGadget(#CheckBox_ScreenCentered, 120, 105, 100, 20, "ScreenCentered ")
CheckBoxGadget(#CheckBox_WindowCentered, 120, 130, 100, 20, "WindowCentered ")
CheckBoxGadget(#CheckBox_Maximize, 120, 155, 100, 20, "Maximize")
CheckBoxGadget(#CheckBox_Minimize, 120, 180, 100, 20, "Minimize")
CheckBoxGadget(#CheckBox_NoGadgets, 120, 205, 100, 20, "NoGadgets")
CheckBoxGadget(#CheckBox_Smart, 240, 155, 90, 20, "SmartWindow")
CheckBoxGadget(#CheckBox_Bound, 365, 155, 90, 20, "WindowBound")
CheckBoxGadget(#CheckBox_Loop, 135, 280, 90, 20, "Inclure Boucle")
ButtonGadget(#Button_NewTab, 240, 280, 75, 20, "", #PB_Button_Default)
ButtonGadget(#Button_OnPlace, 315, 280, 75, 20, "Sur place")
ButtonGadget(#Button_Cancel, 400, 280, 55, 20, "Quitter")
;}
;{/ Gadgets qu'on peut écrire dedans
StringGadget(#String_W, 240, 105, 45, 20, Str(Info\W_Win), #ES_CENTER)
StringGadget(#String_H, 300, 105, 45, 20, Str(Info\H_Win), #ES_CENTER)
StringGadget(#String_X, 355, 105, 45, 20, Str(Info\X_Win), #ES_CENTER)
StringGadget(#String_Y, 410, 105, 45, 20, Str(Info\Y_Win), #ES_CENTER)
StringGadget(#String_WindowIdent, 10, 280, 110, 20, Info\WinId)
StringGadget(#String_Bound_W_Mini, 240, 230, 45, 20, "", #ES_CENTER)
StringGadget(#String_Bound_H_Mini, 300, 230, 45, 20, "", #ES_CENTER)
StringGadget(#String_Bound_W_Maxi, 355, 230, 45, 20, "", #ES_CENTER)
StringGadget(#String_Bound_H_Maxi, 410, 230, 45, 20, "", #ES_CENTER)
StringGadget(#String_Titre, 10, 25, 445, 20, Info\WinTitle)
;}
;{/ Gadgets qu'on peut rien faire dedans
EditorGadget(#Edit_Code, 5, 320, 455, 140, #PB_Editor_ReadOnly)
SetGadgetFont(#Edit_Code, Font)
SetGadgetColor(#Edit_Code, #PB_Gadget_BackColor , $00E1FFFF)
Frame3DGadget(#Frame3D_Attributs, 5, 55, 225, 200, "Attributs de la fenêtre")
Frame3DGadget(#Frame3D_Taille, 235, 55, 225, 75, "Taille - Position de la fenêtre")
Frame3DGadget(#Frame3D_Constante, 5, 260, 120, 50, "Id Fenêtre")
Frame3DGadget(#Frame3D_Loop, 130, 260, 100, 50, "Boucle")
Frame3DGadget(#Frame3D_TailleBound, 235, 185, 225, 70, "Taille Mini/Maxi de la fenêtre")
Frame3DGadget(#Frame3D_Action, 235, 260, 160, 50, "Coller dans")
Frame3DGadget(#Frame3D_Titre, 5, 5, 455, 45, "Titre de la fenêtre")
Frame3DGadget(#Frame3D_Options, 235, 135, 225, 45, "Options")
TextGadget(#Text_Taille, 245, 75, 100, 15, "Taille", #PB_Text_Center)
TextGadget(#Text_Position, 355, 75, 100, 15, "Position", #PB_Text_Center)
TextGadget(#Text_Largeur, 245, 90, 50, 15, "Largeur", #PB_Text_Center)
TextGadget(#Text_Hauteur, 295, 90, 50, 15, "Hauteur", #PB_Text_Center)
TextGadget(#Text_PosX, 355, 90, 45, 15, "X", #PB_Text_Center)
TextGadget(#Text_PosY, 410, 90, 45, 15, "Y", #PB_Text_Center)
TextGadget(#Text_TailleMin, 245, 200, 100, 15, "Taille mini", #PB_Text_Center)
TextGadget(#Text_TailleMax, 355, 200, 100, 15, "Taille maxi", #PB_Text_Center)
TextGadget(#Text_LargeurMin, 240, 215, 45, 15, "Largeur", #PB_Text_Center)
TextGadget(#Text_HauteurMin, 300, 215, 45, 15, "Hauteur")
TextGadget(#Text_LargeurMax, 355, 215, 45, 15, "Largeur")
TextGadget(#Text_HauteurMax, 410, 215, 45, 15, "Hauteur")
;}
;{/ Euhhh ... les autres trucs
For i =#String_Bound_W_Mini To #String_Bound_H_Maxi
DisableGadget(i, 1)
Next
DisableGadget(#CheckBox_Bound, 1)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Return, #Button_NewTab)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Control|#PB_Shortcut_Return, #Button_OnPlace)
Button_OnPlace_Tooltip = GadgetBalloonToolTip(#Window_Main, #Button_OnPlace, "Coller la fenêtre à la position du curseur."+Chr(10)+Chr(10)+"[Ctrl]+[Entrée]")
Button_NewTab_Tooltip = GadgetBalloonToolTip(#Window_Main, #Button_NewTab, "Coller dans un nouvel onglet."+Chr(10)+Chr(10)+"[Entrée]")
CheckBox_BorderLess_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_BorderLess ,"Créer une fenêtre sans bordures" )
CheckBox_Bound_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_Bound , "Définit les dimensions maxi et mini de la fenêtre" )
CheckBox_Invisible_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_Invisible ,"Créer une fenêtre invisible" )
CheckBox_Loop_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_Loop , "Inclure la boucle dans le code")
CheckBox_Maximize_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_Maximize , "Ouvrir la fenêtre en mode maximisé")
CheckBox_MaximizeGadget_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_MaximizeGadget , "Ajouter le bouton 'Maximiser' en haut de la fenêtre")
CheckBox_Minimize_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_Minimize , "Ouvrir la fenêtre en mode Minimisé" )
CheckBox_MinimizeGadget_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_MinimizeGadget , "Ajouter le bouton 'Minimiser' en haut de la fenêtre")
CheckBox_NoGadgets_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_NoGadgets , "Créer une fenêtre sans gadgets")
CheckBox_ScreenCentered_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_ScreenCentered , "Créer une fenêtre centrée dans l'écran")
CheckBox_SizeGadget_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_SizeGadget , "Créer une fenêtre redimensionnable")
CheckBox_Smart_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_Smart , "Tente d'empecher le scintillement de la fenêtre lors des redimensionnements" )
CheckBox_SystemMenu_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_SystemMenu , "Créer une fenêtre avec le menu système")
CheckBox_TitleBar_TT = GadgetBalloonToolTip( #Window_Main,#CheckBox_TitleBar , "Créer une fenêtre avec une barre de titre")
CheckBox_Tool_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_Tool , "Créer une fenêtre avec une barre de titre réduite")
CheckBox_WindowCentered_TT = GadgetBalloonToolTip(#Window_Main ,#CheckBox_WindowCentered , "Créer une fenêtre centrée dans la fenêtre mère")
If RunOneWin
SetGadgetText(#Button_NewTab, "Nouvel onglet")
Else
DisableGadget(#Button_OnPlace, 1)
SetGadgetText(#Button_NewTab, "Copier")
EndIf
;}
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
Procedure OpenWin_Test()
If IsWindow(#Window_Test)
CloseWindow(#Window_Test)
EndIf
OpenWindow(#Window_Test, Info\X_Win, Info\Y_Win, Info\W_Win, Info\H_Win, Info\WinTitle, T)
If Info\WinBound = 1
WindowBounds(#Window_Test, Info\BndMin_W, Info\BndMin_H, Info\BndMax_W, Info\BndMax_H)
EndIf
SetActiveWindow(#Window_Main)
EndProcedure
Procedure SavePref()
If CreatePreferences(GetCurrentDirectory()+"WindowMaker.ini")
PosX = WindowX(#Window_Main) : PosY = WindowY(#Window_Main)
PreferenceGroup("Position")
WritePreferenceInteger("PosX", PosX)
WritePreferenceInteger("PosY", PosY)
ClosePreferences()
EndIf
EndProcedure
Procedure LoadPref()
If OpenPreferences(GetCurrentDirectory()+"WindowMaker.ini")
PreferenceGroup("Position")
PosX = ReadPreferenceInteger("PosX", 800)
PosY = ReadPreferenceInteger("PosY", 400)
ClosePreferences()
EndIf
EndProcedure
Procedure WinCallback(hWin, Msge, wParam, lParam)
Ret = #PB_ProcessPureBasicEvents
Select hWin
Case WindowID(#Window_Main)
Select Msge
Case #PB_Event_SizeWindow
ResizeGadget(#Edit_Code, #PB_Ignore, #PB_Ignore, WindowWidth(#Window_Main) - 10, WindowHeight(#Window_Main) - 325)
EndSelect
EndSelect
If IsWindow(#Window_Test)
If hWin = WindowID(#Window_Test)
If Msge = #PB_Event_SizeWindow
Info\W_Win = WindowWidth(#Window_Test) : SetGadgetText(#String_W, Str(Info\W_Win))
Info\H_Win = WindowHeight(#Window_Test) : SetGadgetText(#String_H, Str(Info\H_Win))
EndIf
If Msge = #PB_Event_MoveWindow
Info\X_Win = WindowX(#Window_Test) : SetGadgetText(#String_X, Str(Info\X_Win))
Info\Y_Win = WindowY(#Window_Test) : SetGadgetText(#String_Y, Str(Info\Y_Win))
EndIf
EndIf
EndIf
ProcedureReturn Ret
EndProcedure
Procedure BuildString()
WinId.s = Info\WinId : T = 0 : Param.s = ""
;{/ Création de la chaine "Identifiant"
If Left(WinId, 1)<> "#" : WinId = "#" + WinId : EndIf
If Left(WinId, 1) = "#"
If Mid(WinId, 2, 1) >="0" And Mid(WinId, 2, 1) <="9" : WinId = "#Window_0" : EndIf
EndIf
If WinId = "#" : WinId = "#Window_0" : EndIf;}
;{/ Création de la chaine "Titre"
WinTitre.s = Chr(34) + Info\WinTitle + Chr(34)
;}
;{/ Création de la chaine "Taille et Position"
WinX.s = Str(Info\X_Win) : If Info\X_Win = #PB_Ignore : WinX = "#PB_Ignore" : EndIf
WinY.s = Str(Info\Y_Win) : If Info\Y_Win = #PB_Ignore : WinY = "#PB_Ignore" : EndIf
WinW.s = Str(Info\W_Win) : If Info\W_Win = #PB_Ignore : WinW = "#PB_Ignore" : EndIf
WinH.s = Str(Info\H_Win) : If Info\H_Win = #PB_Ignore : WinH = "#PB_Ignore" : EndIf
;}
;{/ Création de la chaine "Attributs"
ForEach WinParams()
If WinParams()\Check = 1 : Param + WinParams()\s_Param : T | WinParams()\l_Param : EndIf
Next
If Right(Param, 1) = "|" : Param = Left(Param, Len(Param)-1) : EndIf
;}
;{/ Création de la chaine "OpenWindow"
WinString.s = WinId+", "+WinX+", "+WinY+", "+WinW+", "+WinH+", "+WinTitre+", "+Param
WinString = Trim(WinString)
If Right(WinString,1) = "," : WinString = Left(WinString, Len(WinString)-1) : EndIf
Cmd_OpenWindow.s = "If OpenWindow("+WinString+")"
;}
;{/ Creation de la chaine "WindowBounds"
If Info\BndMin_W = #PB_Ignore
BndMinW.s = "#PB_Ignore"
Else
BndMinW = Str(Info\BndMin_W)
EndIf
If Info\BndMin_H = #PB_Ignore
BndMinH.s = "#PB_Ignore"
Else
BndMinH = Str(Info\BndMin_H)
EndIf
If Info\BndMax_W = #PB_Ignore
BndMaxW.s = "#PB_Ignore"
Else
BndMaxW = Str(Info\BndMax_W)
EndIf
If Info\BndMax_H = #PB_Ignore
BndMaxH.s = "#PB_Ignore"
Else
BndMaxH = Str(Info\BndMax_H)
EndIf
If Info\WinBound = 1
Cmd_WinBounds.s = "WindowBounds("+WinId+", "+BndMinW+", "+BndMinH+", "+BndMaxW+", "+BndMaxH+")"
Else
Cmd_WinBounds = ""
EndIf
;}
;{/ Création de la chaine "SmartWindowRefresh"
If Info\WinSmart = 1
Cmd_WinSmart.s = "SmartWindowRefresh(" + WinId+", 1)"
EndIf ;}
;{/ Création du code dans l'éditeur
ClearGadgetItems(#Edit_Code)
AddGadgetItem(#Edit_Code, 0, "Enumeration")
AddGadgetItem(#Edit_Code, 1, " " + WinId)
AddGadgetItem(#Edit_Code, 2, "EndEnumeration")
AddGadgetItem(#Edit_Code, 4, Cmd_OpenWindow)
If Info\WinBound = 1 : AddGadgetItem(#Edit_Code, -1, " " + Cmd_WinBounds) : EndIf
If Info\WinSmart = 1 : AddGadgetItem(#Edit_Code, -1, " " + Cmd_WinSmart) : EndIf
AddGadgetItem(#Edit_Code, -1, "")
AddGadgetItem(#Edit_Code, -1, " ; Vos gadgets ici")
AddGadgetItem(#Edit_Code, -1, "")
AddGadgetItem(#Edit_Code, -1, "Endif")
AddGadgetItem(#Edit_Code, -1, "")
If GetGadgetState(#CheckBox_Loop) = 1
AddGadgetItem(#Edit_Code, -1, "Repeat")
AddGadgetItem(#Edit_Code, -1, " Select WaitWindowEvent()")
AddGadgetItem(#Edit_Code, -1, " Case #PB_Event_CloseWindow")
AddGadgetItem(#Edit_Code, -1, " Quit = #True")
AddGadgetItem(#Edit_Code, -1, "")
AddGadgetItem(#Edit_Code, -1, " EndSelect")
AddGadgetItem(#Edit_Code, -1, "Until Quit")
AddGadgetItem(#Edit_Code, -1, "End")
EndIf ;}
EndProcedure
Procedure SendDatasToEditor(MainWin, Text$, Mode.l)
If RunOneWin
If Text$
cd.COPYDATASTRUCT
cd\dwData = Mode
cd\cbData = Len(Text$)+1
cd\lpData = @Text$
SendMessage_(RunOneWin, #WM_COPYDATA, MainWin, cd)
EndIf
Else
ClearClipboard()
SetClipboardText(Text$)
MessageRequester("Terminé", "jaPBe n'a pas été détecté." + Chr(10) + "Les données ont été placées dans le presse-papier.", #MB_OK|#MB_ICONINFORMATION)
EndIf
EndProcedure
;}
;{- Initialisation du programme
LoadPref()
If OpenWin_Main() = 0
End
Else
OpenWin_Test() : BuildString()
RemoveKeyboardShortcut(#Window_Main, #PB_Key_All)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Return, 0)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Tab, 0)
SetWindowCallback(@WinCallback())
EndIf
;}
;{- Boucle des évènements
Repeat
Select WaitWindowEvent()
Case #PB_Event_Menu ;{
Select EventMenu()
Case 0
OpenWin_Test()
If Gadget >= #String_W And Gadget <= #String_Titre
Gadget +1
Else
Gadget = #String_W
EndIf
SetActiveGadget(Gadget)
EndSelect ;}
Case #PB_Event_CloseWindow ;{
SavePref() : CloseWindow(#Window_Test) : Quit = #True ;}
Case #PB_Event_Gadget ;{
If EventGadget() >=#CheckBox_SystemMenu And EventGadget()<=#CheckBox_NoGadgets ;{
SelectElement(WinParams(), EventGadget()) : WinParams()\Check = GetGadgetState(EventGadget())
BuildString() : OpenWin_Test()
EndIf ;}
Select EventGadget()
Case #String_Titre ;{
If EventType() = #PB_EventType_Focus
SendMessage_(GadgetID(#String_Titre), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_Change
Info\WinTitle = GetGadgetText(#String_Titre)
BuildString() : SetWindowTitle(#Window_Test, Info\WinTitle)
EndIf ;}
Case #String_WindowIdent ;{
If EventType() = #PB_EventType_Focus
SendMessage_(GadgetID(#String_WindowIdent), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_Change
Info\WinId = GetGadgetText(#String_WindowIdent)
BuildString()
EndIf ;}
Case #String_X ;{
Info\X_Win = Val(GetGadgetText(#String_X))
If EventType() = #PB_EventType_Focus
Gadget = #String_X
SendMessage_(GadgetID(Gadget), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_LostFocus
ResizeWindow(#Window_Test, Info\X_Win, Info\Y_Win, Info\W_Win, Info\H_Win)
EndIf ;}
Case #String_Y ;{
Info\Y_Win = Val(GetGadgetText(#String_Y))
If EventType() = #PB_EventType_Focus
Gadget = #String_Y
SendMessage_(GadgetID(Gadget), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_LostFocus
ResizeWindow(#Window_Test, Info\X_Win, Info\Y_Win, Info\W_Win, Info\H_Win)
EndIf ;}
Case #String_W ;{
Info\W_Win = Val(GetGadgetText(#String_W))
If EventType() = #PB_EventType_Focus
Gadget = #String_W
SendMessage_(GadgetID(Gadget), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_LostFocus
ResizeWindow(#Window_Test, Info\X_Win, Info\Y_Win, Info\W_Win, Info\H_Win)
EndIf ;}
Case #String_H ;{
Info\H_Win = Val(GetGadgetText(#String_H))
If EventType() = #PB_EventType_Focus
Gadget = #String_H
SendMessage_(GadgetID(Gadget), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_LostFocus
ResizeWindow(#Window_Test, Info\X_Win, Info\Y_Win, Info\W_Win, Info\H_Win)
EndIf ;}
Case #String_Bound_W_Mini ;{
If GetGadgetText(#String_Bound_W_Mini) = ""
Info\BndMin_W = #PB_Ignore
Else
Info\BndMin_W = Val(GetGadgetText(#String_Bound_W_Mini))
EndIf
If EventType() = #PB_EventType_Focus
Gadget = #String_Bound_W_Mini
SendMessage_(GadgetID(Gadget), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_LostFocus
BuildString()
EndIf ;}
Case #String_Bound_H_Mini ;{
If GetGadgetText(#String_Bound_H_Mini) = ""
Info\BndMin_H = #PB_Ignore
Else
Info\BndMin_H = Val(GetGadgetText(#String_Bound_H_Mini))
EndIf
If EventType() = #PB_EventType_Focus
Gadget = #String_Bound_H_Mini
SendMessage_(GadgetID(Gadget), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_LostFocus
BuildString()
EndIf ;}
Case #String_Bound_W_Maxi ;{
If GetGadgetText(#String_Bound_W_Maxi) = ""
Info\BndMax_W = #PB_Ignore
Else
Info\BndMax_W = Val(GetGadgetText(#String_Bound_W_Maxi))
EndIf
If EventType() = #PB_EventType_Focus
Gadget = #String_Bound_W_Maxi
SendMessage_(GadgetID(Gadget), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_LostFocus
BuildString()
EndIf ;}
Case #String_Bound_H_Maxi ;{
If GetGadgetText(#String_Bound_H_Maxi) = ""
Info\BndMax_H = #PB_Ignore
Else
Info\BndMax_H = Val(GetGadgetText(#String_Bound_H_Maxi))
EndIf
If EventType() = #PB_EventType_Focus
Gadget = #String_Bound_H_Maxi
SendMessage_(GadgetID(Gadget), #EM_SETSEL, 0, -1)
EndIf
If EventType() = #PB_EventType_LostFocus
BuildString()
EndIf ;}
Case #CheckBox_SizeGadget ;{
If GetGadgetState(#CheckBox_SizeGadget) = 0
Info\WinBound = 0
SetGadgetState(#CheckBox_Bound, Info\WinBound)
DisableGadget(#CheckBox_Bound, 1)
Else
Info\WinBound = 1
DisableGadget(#CheckBox_Bound, 0)
EndIf
BuildString() ;}
Case #CheckBox_Bound ;{
For i = #String_Bound_W_Mini To #String_Bound_H_Maxi
If GetGadgetState(#CheckBox_Bound) = 0 : SetGadgetText(i, "") : EndIf
DisableGadget(i, (Not GetGadgetState(#CheckBox_Bound)))
Next
Info\WinBound = GetGadgetState(#CheckBox_Bound) : BuildString() : OpenWin_Test() ;}
Case #CheckBox_Smart ;{
Info\WinSmart = GetGadgetState(#CheckBox_Smart)
BuildString() ;}
Case #CheckBox_Loop ;{
BuildString() ;}
Case #Button_Cancel ;{
SavePref() : CloseWindow(#Window_Test) : Quit = #True ;}
Case #Button_OnPlace ;{
SendMessage_(GadgetID(#Edit_Code), #EM_SETSEL, 0, -1)
StringToSend$ = GetGadgetText(#Edit_Code)
SendDatasToEditor(WindowID(#Window_Main), Trim(StringToSend$), #WMCD_InsertText)
SendMessage_(GadgetID(#Edit_Code), #EM_SETSEL, -1, -1) ;}
Case #Button_NewTab ;{
SendMessage_(GadgetID(#Edit_Code), #EM_SETSEL, 0, -1)
StringToSend$ = GetGadgetText(#Edit_Code)
SendDatasToEditor(WindowID(#Window_Main), Trim(StringToSend$), #wmcd_NewText)
SendMessage_(GadgetID(#Edit_Code), #EM_SETSEL, -1, -1) ;}
EndSelect
;}
EndSelect
Until Quit
End
;}
;{- Datas
DataSection
ParamText:
Data.s "#PB_Window_SystemMenu|","#PB_Window_MinimizeGadget|","#PB_Window_MaximizeGadget|","#PB_Window_SizeGadget|"
Data.s "#PB_Window_Invisible|","#PB_Window_TitleBar|","#PB_Window_BorderLess|","#PB_Window_Tool|","#PB_Window_ScreenCentered|"
Data.s "#PB_Window_WindowCentered|","#PB_Window_Maximize|","#PB_Window_Minimize|","#PB_Window_NoGadgets|"
ParamLong:
Data.l #PB_Window_SystemMenu,#PB_Window_MinimizeGadget,#PB_Window_MaximizeGadget,#PB_Window_SizeGadget
Data.l #PB_Window_Invisible,#PB_Window_TitleBar,#PB_Window_BorderLess,#PB_Window_Tool,#PB_Window_ScreenCentered
Data.l #PB_Window_WindowCentered,#PB_Window_Maximize,#PB_Window_Minimize,#PB_Window_NoGadgets
EndDataSection
;}
- falsam
- Messages : 7321
- Inscription : dim. 22/août/2010 15:24
- Localisation : IDF (Yvelines)
- Contact :
Re: WindowMaker
je glane ce code
Merci Chris.

Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
- Kwai chang caine
- Messages : 6989
- Inscription : sam. 23/sept./2006 18:32
- Localisation : Isere
Re: WindowMaker
Merci pour le partage 
