CreationGuiPB

Everything else that doesn't fall into one of the other PB categories.
AZJIO
Addict
Addict
Posts: 2154
Joined: Sun May 14, 2017 1:48 am

CreationGuiPB

Post by AZJIO »

CreationGuiPB
"Copy" - copy the element string
"Save" - ​​save a file with all window elements. A working example is created.
Clicking on the line with coordinates and size copies them to the clipboard.
Keyboard arrows - move an element. Pressing Ctrl changes the size.

Download: yandex, upload.ee
Video: upload.ee
Video on youtube, upload.ee (Canvas)

Discussion on the Russian forum

Image

The code for the new version does not fit on the page. Removed all comments.
This is an outdated version, download the new one in the archive.

Code: Select all

EnableExplicit

Define *Lang, UserIntLang

If OpenLibrary(0, "kernel32.dll")
	*Lang = GetFunction(0, "GetUserDefaultUILanguage")
	If *Lang
		UserIntLang = CallFunctionFast(*Lang)
	EndIf
	CloseLibrary(0)
EndIf

Global Dim Lng.s(41)
Lng(1) = "Click to send coordinates to clipboard"
Lng(2) = "Save"
Lng(3) = "Save to code"
Lng(4) = "Copy"
Lng(5) = "Copy item to clipboard"
Lng(6) = "Click to add element"
Lng(7) = "Positioning coordinates"
Lng(8) = "Auto-positioning of added gadgets"
Lng(9) = "Pos"
Lng(10) = "Position the selected or added gadget relative to the previous one"
Lng(11) = "Size"
Lng(12) = "Set gadget size"
Lng(13) = "Gadgets Menu"
Lng(14) = "Trsp"
Lng(15) = "Enable transparency"
Lng(16) = "Style"
Lng(17) = "Toggle title style for window magnetism alignment"
Lng(18) = "Element Width"
Lng(19) = "Element Height"
Lng(20) = "Transparency"
Lng(21) = "Height Multiplier"
Lng(22) = "Width multiplier"
Lng(23) = "Window Capture"
Lng(24) = "Copy gadget code"
Lng(25) = "Save"
Lng(26) = "Flags"
Lng(27) = "Rename"
Lng(28) = "Remember dimensions"
Lng(29) = "Remove gadget"
Lng(30) = "Remove all gadgets"
Lng(31) = "Reference"
Lng(32) = "About"
Lng(33) = "Author "
Lng(34) = "Do you want to go to the website?"
Lng(35) = "New name for '"
Lng(36) = "Specify text:"
Lng(37) = "Select a file to save"
Lng(38) = "Open template"
Lng(39) = "Open file?"
Lng(40) = "No data to save"
Lng(41) = "Specify the beginning of the window name"

If UserIntLang = 1049
	Lng(1) = "Кликни для отправки координат в буфер обмена"
; 	...
	Lng(41) = "Укажите начало имени окна"
EndIf

#Window = 0
#Win1 = 1
#Menu = 0

#PB_GadgetType_StatusBar = 34
#PB_GadgetType_ToolBar = 35

Enumeration Gadget
	#btn
	#chTrans
	#lg
	#lvg
	#Coor
	#btnSave
	#btnCopy
	#chStyle
	#txt1
	#txt2
	#StrX
	#StrY
	#txt3
	#txt4
	#StrW
	#StrH
	#chAutoPos
	#PosXY
	#SetWH
	#btnMenu
	#txt5
	#TrackBarH
	#TrackBarV
	#TrackBarTrans
	#Spin0
	#Spin1
	
	#w1_btnOk
	#bf1
	#bf2
	#bf3
	#bf4
	#bf5
	#bf6
	#bf7
	#bf8
	#bf9
	#bf10
	#bf11
	#bfLast
	#BeforeFirstGadget
	#FirstGadget
EndEnumeration


Enumeration Menu
	#mL
	#mR
	#mV
	#mN
	#mL1
	#mR1
	#mV1
	#mN1
	#mPos
	#mCopy
	#mSave
	#mRename
	#mRememberSize
	#mDel
	#mDelAll
	#mL2
	#mR2
	#mV2
	#mN2
	#mProperties
	#mSwap
	#mWinCapture
	#mHelp
	#mAbout
EndEnumeration


#BackColor = $231504
#BackColor2 = $d6d5d4

Global hGUI
Global slider03
Global magnet, delta = 5, delta0 = 5, hide$
Global g_tmp$, tmp2
Global autopos = 1, template, pb_any, iconRequired
Global id_Gadget = #BeforeFirstGadget
Global id_CurGadget, PrevGadget
Global cw, ch
Global NG
Define MouseDown, id_gadget2
Define trn = 2
Define hWnd, gx, gy, i, eg, w, h
Define co.POINT
Define indent.POINT


Global NewList WinPos.POINT()

Structure GadgetsTypeArray
	name.s
	w.i
	h.i
	const.s
	List Properties.s()
EndStructure

Structure GadgetsList
	handle.i
	id.i
	type.i
	List PropCheck.i()
EndStructure

Global NewList GadgetsList.GadgetsList()
Define *element.GadgetsList

Global Dim GadgetsTypeArray.GadgetsTypeArray(35)


GadgetsTypeArray(#PB_GadgetType_Button)\name = "Button"
GadgetsTypeArray(#PB_GadgetType_ButtonImage)\name = "ButtonImage"
GadgetsTypeArray(#PB_GadgetType_Calendar)\name = "Calendar"
GadgetsTypeArray(#PB_GadgetType_Canvas)\name = "Canvas"
GadgetsTypeArray(#PB_GadgetType_CheckBox)\name = "CheckBox"
GadgetsTypeArray(#PB_GadgetType_ComboBox)\name = "ComboBox"
GadgetsTypeArray(#PB_GadgetType_Container)\name = "Container"
GadgetsTypeArray(#PB_GadgetType_Date)\name = "Date"
GadgetsTypeArray(#PB_GadgetType_Editor)\name = "Editor"
GadgetsTypeArray(#PB_GadgetType_ExplorerCombo)\name = "ExplorerCombo"
GadgetsTypeArray(#PB_GadgetType_ExplorerList)\name = "ExplorerList"
GadgetsTypeArray(#PB_GadgetType_ExplorerTree)\name = "ExplorerTree"
GadgetsTypeArray(#PB_GadgetType_Frame)\name = "Frame"
GadgetsTypeArray(#PB_GadgetType_HyperLink)\name = "HyperLink"
GadgetsTypeArray(#PB_GadgetType_Image)\name = "Image"
GadgetsTypeArray(#PB_GadgetType_IPAddress)\name = "IPAddress"
GadgetsTypeArray(#PB_GadgetType_ListIcon)\name = "ListIcon"
GadgetsTypeArray(#PB_GadgetType_ListView)\name = "ListView"
GadgetsTypeArray(#PB_GadgetType_MDI)\name = "MDI"
GadgetsTypeArray(#PB_GadgetType_Option)\name = "Option"
GadgetsTypeArray(#PB_GadgetType_Panel)\name = "Panel"
GadgetsTypeArray(#PB_GadgetType_ProgressBar)\name = "ProgressBar"
GadgetsTypeArray(#PB_GadgetType_Scintilla)\name = "Scintilla"
GadgetsTypeArray(#PB_GadgetType_ScrollArea)\name = "ScrollArea"
GadgetsTypeArray(#PB_GadgetType_ScrollBar)\name = "ScrollBar"
GadgetsTypeArray(#PB_GadgetType_Shortcut)\name = "Shortcut"
GadgetsTypeArray(#PB_GadgetType_Spin)\name = "Spin"
GadgetsTypeArray(#PB_GadgetType_Splitter)\name = "Splitter"
GadgetsTypeArray(#PB_GadgetType_String)\name = "String"
GadgetsTypeArray(#PB_GadgetType_Text)\name = "Text"
GadgetsTypeArray(#PB_GadgetType_TrackBar)\name = "TrackBar"
GadgetsTypeArray(#PB_GadgetType_Tree)\name = "Tree"
GadgetsTypeArray(#PB_GadgetType_Web)\name = "Web"
GadgetsTypeArray(#PB_GadgetType_Unknown)\name = "Unknown"
GadgetsTypeArray(#PB_GadgetType_StatusBar)\name = "StatusBar"
GadgetsTypeArray(#PB_GadgetType_ToolBar)\name = "ToolBar"

GadgetsTypeArray(#PB_GadgetType_Button)\const = "btn"
GadgetsTypeArray(#PB_GadgetType_ButtonImage)\const = "btnimg"
GadgetsTypeArray(#PB_GadgetType_Calendar)\const = "cal"
GadgetsTypeArray(#PB_GadgetType_Canvas)\const = "cnv"
GadgetsTypeArray(#PB_GadgetType_CheckBox)\const = "ch"
GadgetsTypeArray(#PB_GadgetType_ComboBox)\const = "cmbx"
GadgetsTypeArray(#PB_GadgetType_Container)\const = "cnt"
GadgetsTypeArray(#PB_GadgetType_Date)\const = "date"
GadgetsTypeArray(#PB_GadgetType_Editor)\const = "editor"
GadgetsTypeArray(#PB_GadgetType_ExplorerCombo)\const = "expcombo"
GadgetsTypeArray(#PB_GadgetType_ExplorerList)\const = "explist"
GadgetsTypeArray(#PB_GadgetType_ExplorerTree)\const = "exptree"
GadgetsTypeArray(#PB_GadgetType_Frame)\const = "frame"
GadgetsTypeArray(#PB_GadgetType_HyperLink)\const = "lnk"
GadgetsTypeArray(#PB_GadgetType_Image)\const = "img"
GadgetsTypeArray(#PB_GadgetType_IPAddress)\const = "ip"
GadgetsTypeArray(#PB_GadgetType_ListIcon)\const = "lig"
GadgetsTypeArray(#PB_GadgetType_ListView)\const = "lvg"
GadgetsTypeArray(#PB_GadgetType_MDI)\const = "mdi"
GadgetsTypeArray(#PB_GadgetType_Option)\const = "opt"
GadgetsTypeArray(#PB_GadgetType_Panel)\const = "tb"
GadgetsTypeArray(#PB_GadgetType_ProgressBar)\const = "pb"
GadgetsTypeArray(#PB_GadgetType_Scintilla)\const = "scintilla"
GadgetsTypeArray(#PB_GadgetType_ScrollArea)\const = "scrollarea"
GadgetsTypeArray(#PB_GadgetType_ScrollBar)\const = "scrollbar"
GadgetsTypeArray(#PB_GadgetType_Shortcut)\const = "shortcut"
GadgetsTypeArray(#PB_GadgetType_Spin)\const = "spin"
GadgetsTypeArray(#PB_GadgetType_Splitter)\const = "splitter"
GadgetsTypeArray(#PB_GadgetType_String)\const = "str"
GadgetsTypeArray(#PB_GadgetType_Text)\const = "txt"
GadgetsTypeArray(#PB_GadgetType_TrackBar)\const = "trb"
GadgetsTypeArray(#PB_GadgetType_Tree)\const = "tree"
GadgetsTypeArray(#PB_GadgetType_Web)\const = "web"
GadgetsTypeArray(#PB_GadgetType_Unknown)\const = "unk"
GadgetsTypeArray(#PB_GadgetType_StatusBar)\name = "StatusBar"
GadgetsTypeArray(#PB_GadgetType_ToolBar)\name = "ToolBar"



GadgetsTypeArray(1)\w = 70
GadgetsTypeArray(2)\w = 120
GadgetsTypeArray(3)\w = 70
GadgetsTypeArray(4)\w = 120
GadgetsTypeArray(5)\w = 120
GadgetsTypeArray(6)\w = 150
GadgetsTypeArray(7)\w = 200
GadgetsTypeArray(8)\w = 120
GadgetsTypeArray(9)\w = 24
GadgetsTypeArray(10)\w = 120
GadgetsTypeArray(11)\w = 150
GadgetsTypeArray(12)\w = 150
GadgetsTypeArray(13)\w = 120
GadgetsTypeArray(14)\w = 120
GadgetsTypeArray(15)\w = 120
GadgetsTypeArray(16)\w = 200
GadgetsTypeArray(17)\w = 120
GadgetsTypeArray(18)\w = 300
GadgetsTypeArray(19)\w = 24
GadgetsTypeArray(20)\w = 170
GadgetsTypeArray(21)\w = 120
GadgetsTypeArray(22)\w = 200
GadgetsTypeArray(23)\w = 200
GadgetsTypeArray(24)\w = 200
GadgetsTypeArray(25)\w = 200
GadgetsTypeArray(26)\w = 40
GadgetsTypeArray(27)\w = 200
GadgetsTypeArray(28)\w = 200

GadgetsTypeArray(1)\h = 27
GadgetsTypeArray(2)\h = 24
GadgetsTypeArray(3)\h = 22
GadgetsTypeArray(4)\h = 22
GadgetsTypeArray(5)\h = 22
GadgetsTypeArray(6)\h = 150
GadgetsTypeArray(7)\h = 200
GadgetsTypeArray(8)\h = 24
GadgetsTypeArray(9)\h = 24
GadgetsTypeArray(10)\h = 24
GadgetsTypeArray(11)\h = 150
GadgetsTypeArray(12)\h = 150
GadgetsTypeArray(13)\h = 24
GadgetsTypeArray(14)\h = 24
GadgetsTypeArray(15)\h = 16
GadgetsTypeArray(16)\h = 200
GadgetsTypeArray(17)\h = 30
GadgetsTypeArray(18)\h = 200
GadgetsTypeArray(19)\h = 24
GadgetsTypeArray(20)\h = 170
GadgetsTypeArray(21)\h = 24
GadgetsTypeArray(22)\h = 200
GadgetsTypeArray(23)\h = 200
GadgetsTypeArray(24)\h = 200
GadgetsTypeArray(25)\h = 24
GadgetsTypeArray(26)\h = 24
GadgetsTypeArray(27)\h = 200
GadgetsTypeArray(28)\h = 200



Declare SizeWindowHandler()
Declare AddGadget(item)
Declare GetGadgetPB(Handle)
Declare moveLR(shift)
Declare moveVN(shift)
Declare moveLR1(shift)
Declare moveVN1(shift)
Declare moveLR2(shift)
Declare moveVN2(shift)
Declare Copy()
Declare Save()
Declare PosXY()
Declare Properties()
Declare WinCapture()
Declare hide()
Declare SetTextCoor(g)
Declare Limit(*Value.integer, Min, Max)
Declare WinCallback(hWnd, uMsg, WParam, LParam)
Declare SplitL(String.s, List StringList.s(), Separator.s = " ")
DeclareDLL ScintillaCallBack(Gadget, *scinotify.SCNotification)


slider03 = 55

w = 440
h = 370
cw = w
ch = h

Global ini$
ini$ = GetPathPart(ProgramFilename()) + GetFilePart(ProgramFilename(), #PB_FileSystem_NoExtension) + ".ini"

If OpenPreferences(ini$)
	PreferenceGroup("set")
		w = ReadPreferenceInteger("width", w)
		h = ReadPreferenceInteger("height", h)
		hide$ = ReadPreferenceString("hide", "")
		template = ReadPreferenceInteger("template", template)
		autopos = ReadPreferenceInteger("autopos", autopos)
		pb_any = ReadPreferenceInteger("pb_any", pb_any)
		magnet = ReadPreferenceInteger("magnet", magnet)
		delta0 = ReadPreferenceInteger("delta", delta0)
		delta = delta0
		PreferenceGroup("const")
		ExaminePreferenceKeys()
		i = 0
		While  NextPreferenceKey()
			If i > 35
				Break
			EndIf
			GadgetsTypeArray(i)\const = PreferenceKeyName()
			i + 1
		Wend
		PreferenceGroup("width")
		ExaminePreferenceKeys()
		i = 0
		While  NextPreferenceKey()
			If i > 35
				Break
			EndIf
			GadgetsTypeArray(i)\w = Val(PreferenceKeyName())
			i + 1
		Wend
		PreferenceGroup("height")
		ExaminePreferenceKeys()
		i = 0
		While  NextPreferenceKey()
			If i > 35
				Break
			EndIf
			GadgetsTypeArray(i)\h = Val(PreferenceKeyName())
			i + 1
		Wend
		
		PreferenceGroup("flags")
		For i = 0 To 35
			g_tmp$ = ReadPreferenceString(Str(i), "")
			If Asc(g_tmp$)
				SplitL(g_tmp$, GadgetsTypeArray(i)\Properties(), ",")
			EndIf
		Next
		
	ClosePreferences()
EndIf

hGUI = OpenWindow(#Window, 0, 0, w, h,
                  "CreationGuiPB",
                  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
If hGUI
	WindowBounds(#Window, 400, 370, #PB_Ignore, #PB_Ignore)
	SetWindowLongPtr_(hGUI, #GWL_EXSTYLE, GetWindowLongPtr_(hGUI, #GWL_EXSTYLE) | #WS_EX_TOPMOST | #WS_EX_LAYERED)
	SetLayeredWindowAttributes_(hGUI, #BackColor, 255, trn)


	
	TextGadget(#txt5, w - 218, 3, 44, 22, "xywh:")
	TextGadget(#Coor, w - 174, 3, 175, 22, "00, 00, 00, 00", #SS_NOTIFY | #SS_LEFTNOWORDWRAP)
	GadgetToolTip(#Coor, Lng(1))
	ButtonGadget(#btnSave, w - 55, h - 115, 45, 23, Lng(2))
	GadgetToolTip(#btnSave, Lng(3))

	ButtonGadget(#btnCopy, w - 55, h - 140, 45, 23, Lng(4))
	GadgetToolTip(#btnCopy, Lng(5))

	ListViewGadget(#lvg, w - 125, 27, 115, h - 180)
	GadgetToolTip(#lvg, Lng(6))
	For i = 0 To 27
		AddGadgetItem(#lvg, i, GadgetsTypeArray(i)\name)
		SetGadgetItemData(#lvg, i, i)
	Next
	hide()

	TextGadget(#txt1, w - 210, 28, 35, 22, "x=+")
	TextGadget(#txt2, w - 210, 55, 35, 22, "y=+")
	StringGadget(#StrX, w - 175, 27, 40, 22, "0")
	GadgetToolTip(#StrX, Lng(7))
	StringGadget(#StrY, w - 175, 54, 40, 22, "5")
	GadgetToolTip(#StrY, Lng(7))

	CheckBoxGadget(#chAutoPos, w - 205, 82, 26, 26, "")
	GadgetToolTip(#chAutoPos, Lng(8))
	If autopos
		SetGadgetState(#chAutoPos, #PB_Checkbox_Checked)
	EndIf
	ButtonGadget(#PosXY, w - 180, 82, 45, 26, Lng(9))
	GadgetToolTip(#PosXY, Lng(10))
	ButtonGadget(#SetWH, w - 180, 110, 45, 26, Lng(11))
	GadgetToolTip(#SetWH, Lng(12))

	TextGadget(#txt3, w - 210, 142, 35, 22, "w=")
	TextGadget(#txt4, w - 210, 169, 35, 22, "h=")
	StringGadget(#StrW, w - 175, 141, 40, 22, "120")
	StringGadget(#StrH, w - 175, 168, 40, 22, "22")
	
	If OpenPreferences(ini$)
		PreferenceGroup("set")
		SetGadgetText(#StrX, Str(ReadPreferenceInteger("xp", 0)))
		SetGadgetText(#StrY, Str(ReadPreferenceInteger("yp", 5)))
		SetGadgetText(#StrW, Str(ReadPreferenceInteger("we", 120)))
		SetGadgetText(#StrH, Str(ReadPreferenceInteger("he", 22)))
		ClosePreferences()
	EndIf

	ButtonGadget(#btnMenu, w - 158, 192, 24, 24, Chr($25BC))
	GadgetToolTip(#btnMenu, Lng(13))

	CheckBoxGadget(#chTrans, w - 70, h - 90, 70, 23, Lng(14))
	GadgetToolTip(#chTrans, Lng(15))
	CheckBoxGadget(#chStyle, w - 70, h - 65, 70, 23, Lng(16))
	GadgetToolTip(#chStyle, Lng(17))

	TextGadget(#lg, 0, 0, w - 220, h - 110, "")
	SetGadgetColor(#lg, #PB_Gadget_BackColor, #BackColor2)

	TrackBarGadget(#TrackBarH, w - 190, h - 25, 192, 30, 8 , 200)
	SetGadgetState(#TrackBarH, 50)
	GadgetToolTip(#TrackBarH, Lng(18))

	TrackBarGadget(#TrackBarV, w - 190, h - 180, 30, 150, 38, 150, #PB_TrackBar_Vertical)
	SetGadgetState(#TrackBarV, 140)
	GadgetToolTip(#TrackBarV, Lng(19))

	TrackBarGadget(#TrackBarTrans, w - 100, h - 150, 30, 110, 0, 185, #PB_TrackBar_Vertical)
	SetGadgetState(#TrackBarTrans, 140)
	GadgetToolTip(#TrackBarTrans, Lng(20))

	SpinGadget(#Spin0, w - 160, h - 109, 50, 28, 1 , 11, #PB_Spin_Numeric)
	SpinGadget(#Spin1, w - 160, h - 76, 50, 28, 1 , 11, #PB_Spin_Numeric)
	SetGadgetText(#Spin0, "1")
	SetGadgetText(#Spin1, "1")
	GadgetToolTip(#Spin0, Lng(21))
	GadgetToolTip(#Spin1, Lng(22))

	If CreatePopupMenu(#Menu)
		MenuItem(#mWinCapture, Lng(23) + #TAB$ + "Ctrl+G")
		MenuItem(#mCopy, Lng(24) + #TAB$ + "Ctrl+C")
		MenuItem(#mSave, Lng(25) + #TAB$ + "Ctrl+S")
		MenuBar() 
		MenuItem(#mProperties, Lng(26) + #TAB$ + "F3")
		MenuItem(#mRename, Lng(27) + #TAB$ + "F2")
		MenuItem(#mRememberSize, Lng(28))
		MenuBar() 
		MenuItem(#mDel, Lng(29) + #TAB$ + "Delete")
		MenuItem(#mDelAll, Lng(30) + #TAB$ + "Ctrl+Delete")
		MenuBar() 
		MenuItem(#mHelp, Lng(31) + #TAB$ + "F1")
		MenuItem(#mAbout, Lng(32))
	EndIf

	AddKeyboardShortcut(#Window, #PB_Shortcut_Left, #mL)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Right, #mR)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Up, #mV)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Down, #mN)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_Left, #mL1)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_Right, #mR1)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_Up, #mV1)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_Down, #mN1)
	
	AddKeyboardShortcut(#Window, #PB_Shortcut_Space, #mPos)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Delete, #mDel)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_Delete, #mDel)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_C, #mCopy)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_S, #mSave)
	AddKeyboardShortcut(#Window, #PB_Shortcut_F2, #mRename)
	AddKeyboardShortcut(#Window, #PB_Shortcut_F3, #mProperties)
	AddKeyboardShortcut(#Window, #PB_Shortcut_F4, #mSwap)
	AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_G, #mWinCapture)
	
	If Not magnet
		AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_Shift | #PB_Shortcut_Left, #mL2)
		AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_Shift | #PB_Shortcut_Right, #mR2)
		AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_Shift | #PB_Shortcut_Up, #mV2)
		AddKeyboardShortcut(#Window, #PB_Shortcut_Control | #PB_Shortcut_Shift | #PB_Shortcut_Down, #mN2)
	EndIf

	BindEvent(#PB_Event_SizeWindow, @SizeWindowHandler())
	SetWindowCallback(@WinCallback())

	Repeat
		Select WaitWindowEvent()
			Case #WM_LBUTTONUP
				MouseDown = #False
			Case #WM_LBUTTONDOWN
				GetCursorPos_(@co.POINT)
				hWnd = WindowFromPoint_(co\x | co\y << 32)
				id_gadget2 = GetGadgetPB(hWnd)
				If id_gadget2 > #BeforeFirstGadget And IsGadget(id_gadget2)
					co\x = WindowMouseX(#Window)
					co\y = WindowMouseY(#Window)
					indent\x = co\x - GadgetX(id_gadget2)
					indent\y = co\y - GadgetY(id_gadget2)
					MouseDown = #True
				EndIf
			Case #WM_MOUSEMOVE
				If MouseDown
					co\x = WindowMouseX(#Window)
					co\y = WindowMouseY(#Window)
					ResizeGadget(id_gadget2, co\x - indent\x, co\y - indent\y, #PB_Ignore , #PB_Ignore)
					SetTextCoor(id_gadget2)
					UpdateWindow_(hGUI)
				EndIf
			Case #PB_Event_RightClick
				If id_Gadget > #BeforeFirstGadget
					DisplayPopupMenu(#Menu, WindowID(#Window))
				EndIf
			Case #PB_Event_Timer
				If EventTimer() = 0
					SetGadgetColor(#Coor, #PB_Gadget_BackColor, #PB_Default)
					RemoveWindowTimer(#Window, 0)
				EndIf

			Case #PB_Event_Gadget
				eg = EventGadget()
				Select eg
					Case #FirstGadget To 2000
						If ListSize(GadgetsList()) = 1
							id_CurGadget = eg
							PrevGadget = id_CurGadget
						ElseIf eg = id_Gadget
							id_CurGadget = id_Gadget
							PrevGadget = id_CurGadget - 1
						Else
							id_CurGadget = eg
							PrevGadget = id_CurGadget - 1
						EndIf
						SetTextCoor(eg)
					Case #btnMenu
						DisplayPopupMenu(#Menu, WindowID(#Window))
					Case #SetWH
						gx = Val(GetGadgetText(#StrW))
						gy = Val(GetGadgetText(#StrH))
						If gx > 0 And gy > 0 And IsGadget(id_Gadget) And id_Gadget > #BeforeFirstGadget
							ResizeGadget(id_Gadget, #PB_Ignore, #PB_Ignore, gx, gy)
						EndIf
					Case #PosXY
						PosXY()
					Case #btnCopy
						Copy()
					Case #btnSave
						Save()
					Case #Coor
						SetClipboardText(GetGadgetText(#Coor))
						SetGadgetColor(#Coor, #PB_Gadget_BackColor, $8080FF)
						AddWindowTimer(#Window, 0, 55)
					Case #chStyle
						If GetGadgetState(#chStyle) & #PB_Checkbox_Checked
							SetWindowLongPtr_(hGUI, #GWL_STYLE, GetWindowLongPtr_(hGUI, #GWL_STYLE) ! #WS_SIZEBOX)
							SetWindowLongPtr_(hGUI, #GWL_EXSTYLE, GetWindowLongPtr_(hGUI, #GWL_EXSTYLE) | #WS_EX_TOOLWINDOW)
							delta = 0
						Else
							SetWindowLongPtr_(hGUI, #GWL_STYLE, GetWindowLongPtr_(hGUI, #GWL_STYLE) | #WS_SIZEBOX)
							SetWindowLongPtr_(hGUI, #GWL_EXSTYLE, GetWindowLongPtr_(hGUI, #GWL_EXSTYLE) ! #WS_EX_TOOLWINDOW)
							delta = delta0
						EndIf
						ResizeWindow(#Window, #PB_Ignore, #PB_Ignore, #PB_Ignore, WindowHeight(#Window) + 1)
						ResizeWindow(#Window, #PB_Ignore, #PB_Ignore, #PB_Ignore, WindowHeight(#Window) - 1)
					Case #chTrans
						If GetGadgetState(#chTrans) & #PB_Checkbox_Checked
							SetLayeredWindowAttributes_(hGUI, #BackColor, 255 - slider03, trn)
						Else
							SetLayeredWindowAttributes_(hGUI, #BackColor2, 0, 1)
						EndIf
					Case #Spin0
						Select EventType()
							Case #PB_EventType_Up, #PB_EventType_Down
								tmp2 = 185 - GetGadgetState(#TrackBarV)
								If tmp2 < 3
									tmp2 = 3
								EndIf
								If id_CurGadget > #BeforeFirstGadget And tmp2 > 2
									*element = GetGadgetData(id_CurGadget)
									tmp2 * Val(GetGadgetText(#Spin0))
									tmp2 * GadgetsTypeArray(*element\type)\h / 45
									Limit(@tmp2, 7, 1000)
									ResizeGadget(id_CurGadget, #PB_Ignore, #PB_Ignore, #PB_Ignore, tmp2)
									SetTextCoor(id_CurGadget)
								EndIf
						EndSelect
					Case #Spin1
						Select EventType()
							Case #PB_EventType_Up, #PB_EventType_Down
								tmp2 = GetGadgetState(#TrackBarH)
								If tmp2 < 10
									tmp2 = 10
								EndIf
								If id_CurGadget > #BeforeFirstGadget And tmp2 > 2
									*element = GetGadgetData(id_CurGadget)
									tmp2 * Val(GetGadgetText(#Spin1))
									tmp2 * GadgetsTypeArray(*element\type)\w / 50
									Limit(@tmp2, 7, 1000)
									ResizeGadget(id_CurGadget, #PB_Ignore, #PB_Ignore, tmp2 , #PB_Ignore)
									SetTextCoor(id_CurGadget)
								EndIf
						EndSelect
					Case #lvg
						tmp2 = GetGadgetItemData(#lvg, GetGadgetState(#lvg))
						AddGadget(tmp2)
				EndSelect

			Case #PB_Event_Menu
				Select EventMenu()
					Case #mAbout
						If MessageRequester(Lng(32), Lng(33) + "AZJIO" + #CRLF$ + "v0.5.0" + #CRLF$ + 
						                                   Lng(34), #PB_MessageRequester_YesNo | #MB_DEFBUTTON2) = #PB_MessageRequester_Yes
							RunProgram("https://www.purebasic.fr/english/viewtopic.php?t=85692")
						EndIf
					Case #mHelp
						RunProgram("CreationGuiPB.chm")
					Case #mWinCapture
						WinCapture()
					Case #mSwap
						gx = Val(GetGadgetText(#StrX))
						gy = Val(GetGadgetText(#StrY))
						SetGadgetText(#StrX, Str(gy))
						SetGadgetText(#StrY, Str(gx))
					Case #mCopy
						Copy()
					Case #mSave
						Save()
					Case #mProperties
						Properties()
					Case #mDelAll
						ForEach GadgetsList()
							If IsGadget(GadgetsList()\id)
								FreeGadget(GadgetsList()\id)
							EndIf
						Next
						ClearList(GadgetsList())
						NG = 0
						id_CurGadget = 0
						id_Gadget = #BeforeFirstGadget
					Case #mDel
						If id_CurGadget > #BeforeFirstGadget
							*element = GetGadgetData(id_CurGadget)
							ChangeCurrentElement(GadgetsList() , *element)
							FreeGadget(id_CurGadget)
							DeleteElement(GadgetsList())
							Repeat
								id_CurGadget - 1
							Until IsGadget(id_CurGadget)
							If id_CurGadget < #FirstGadget And ListSize(GadgetsList()) = 0
								NG = 0
								id_CurGadget = 0
								id_Gadget = #BeforeFirstGadget
							EndIf
						EndIf
					Case #mRememberSize
						If id_CurGadget > #BeforeFirstGadget
							*element = GetGadgetData(id_CurGadget)
							GadgetsTypeArray(*element\type)\w = GadgetWidth(id_CurGadget)
							GadgetsTypeArray(*element\type)\h = GadgetHeight(id_CurGadget)
						EndIf
					Case #mPos
						PosXY()
					Case #mRename
						If id_CurGadget > #BeforeFirstGadget
							g_tmp$ = InputRequester(Lng(35) + GetGadgetText(id_CurGadget) + "'", Lng(36), "")
							If Asc(g_tmp$)
								SetGadgetText(id_CurGadget, g_tmp$)
							EndIf
						EndIf
					Case #mL
						moveLR( - 1)
					Case #mR
						moveLR(1)
					Case #mV
						moveVN( - 1)
					Case #mN
						moveVN(1)

					Case #mL1
						moveLR1( - 1)
					Case #mR1
						moveLR1(1)
					Case #mV1
						moveVN1( - 1)
					Case #mN1
						moveVN1(1)

					Case #mL2
						moveLR2( - 1)
					Case #mR2
						moveLR2(1)
					Case #mV2
						moveVN2( - 1)
					Case #mN2
						moveVN2(1)
				EndSelect
			Case #PB_Event_CloseWindow
				If w <> cw Or h <> ch
					If OpenPreferences(ini$)
						PreferenceGroup("set")
						WritePreferenceInteger("width", cw)
						WritePreferenceInteger("height", ch)
						ClosePreferences()
					EndIf
				EndIf
				CloseWindow(#Window)
				End
		EndSelect
	ForEver
EndIf



Procedure.s ReadFileToVar(Path$)
	Protected id_file, Format, Text$
	
	id_file = ReadFile(#PB_Any, Path$)
	If id_file
		Format = ReadStringFormat(id_file)
		Text$ = ReadString(id_file, Format | #PB_File_IgnoreEOL)
		CloseFile(id_file)
	EndIf
	
	ProcedureReturn Text$
EndProcedure


Procedure hide()
	Protected NewMap ChDub()
	Protected NewList Num()
	Protected NewList StrL.s()
	SplitL(hide$ + ",0,15,16,11", StrL(), ",")
	
	ForEach StrL()
		StrL() = Trim(StrL())
		If Not FindMapElement(ChDub(), StrL())
			AddMapElement(ChDub(), StrL(), #PB_Map_NoElementCheck)
			AddElement(Num())
			Num() = Val(StrL())
		EndIf
	Next
	
	SortList(Num(), #PB_Sort_Descending)
	ForEach Num()
		RemoveGadgetItem(#lvg, Num())
	Next
EndProcedure


Procedure Limit(*Value.integer, Min, Max)
	If *Value\i < Min
		*Value\i = Min
	ElseIf *Value\i > Max
		*Value\i = Max
	EndIf
EndProcedure


Procedure Save()
	Protected code$, const$, Gadgets$, Event$, n, i, Path$

	If ListSize(GadgetsList())
		Path$ = SaveFileRequester(Lng(37), GetCurrentDirectory() + "Form.pb", "*.pb|*.pb;*.pbi;*.pbf", 0)
		If Asc(Path$)
			If Not FindString(Right(Path$, 4), ".pb")
				Path$ + ".pb"
			EndIf
			n = 0			
			ForEach GadgetsList()
				If IsGadget(GadgetsList()\id)
					
					If pb_any
						Event$ + #TAB$ + #TAB$ + #TAB$ + #TAB$ + "Case " + GadgetsTypeArray(GadgetsList()\type)\const + Str(n) + 
						         #CRLF$ + #TAB$ + #TAB$ + #TAB$ + #TAB$ + #TAB$ + #CRLF$
						const$ + "Global " + GadgetsTypeArray(GadgetsList()\type)\const + Str(n) + #CRLF$
						Gadgets$ + GadgetsTypeArray(GadgetsList()\type)\const + Str(n) + " = " + GadgetsTypeArray(GadgetsList()\type)\name + "Gadget(#PB_Any, " + Str(GadgetX(GadgetsList()\id)) + ", " + Str(GadgetY(GadgetsList()\id)) + ", " + Str(GadgetWidth(GadgetsList()\id)) + ", " + Str(GadgetHeight(GadgetsList()\id))
					Else
						Event$ + #TAB$ + #TAB$ + #TAB$ + #TAB$ + "Case #" + GadgetsTypeArray(GadgetsList()\type)\const + Str(n) + 
						         #CRLF$ + #TAB$ + #TAB$ + #TAB$ + #TAB$ + #TAB$ + #CRLF$
						const$ + #TAB$ + "#" + GadgetsTypeArray(GadgetsList()\type)\const + Str(n) + #CRLF$
						Gadgets$ + GadgetsTypeArray(GadgetsList()\type)\name + "Gadget(#" + GadgetsTypeArray(GadgetsList()\type)\const + Str(n) + ", " + Str(GadgetX(GadgetsList()\id)) + ", " + Str(GadgetY(GadgetsList()\id)) + ", " + Str(GadgetWidth(GadgetsList()\id)) + ", " + Str(GadgetHeight(GadgetsList()\id))
					EndIf
					Select GadgetsList()\type
						Case #PB_GadgetType_ComboBox, #PB_GadgetType_Editor, #PB_GadgetType_ListView, #PB_GadgetType_Tree, #PB_GadgetType_Calendar, #PB_GadgetType_ScrollBar, #PB_GadgetType_Date, #PB_GadgetType_Canvas, #PB_GadgetType_IPAddress, #PB_GadgetType_Panel
							Gadgets$ + ")" + #CRLF$
						Case #PB_GadgetType_ListIcon
							Gadgets$ + ", " + #DQUOTE$ + GetGadgetText(GadgetsList()\id) + #DQUOTE$ + ", " + Str(GadgetWidth(GadgetsList()\id)) + ")" + #CRLF$
						Case #PB_GadgetType_Web, #PB_GadgetType_ExplorerList, #PB_GadgetType_ExplorerTree, #PB_GadgetType_ExplorerCombo
							Gadgets$ + ", " + #DQUOTE$ + "C:\" + #DQUOTE$ + ")" + #CRLF$
						Case #PB_GadgetType_ProgressBar, #PB_GadgetType_Spin, #PB_GadgetType_TrackBar, #PB_GadgetType_ScrollBar
							Gadgets$ + ", 0, 100)" + #CRLF$
						Case #PB_GadgetType_Image
							Gadgets$ + ", icon)" + #CRLF$
						Case #PB_GadgetType_ButtonImage
							Gadgets$ + ", icon)" + #CRLF$
						Case #PB_GadgetType_HyperLink
							Gadgets$ + ", " + #DQUOTE$ + GetGadgetText(GadgetsList()\id) + #DQUOTE$ + ", $FF0000)" + #CRLF$
						Default 
							Gadgets$ + ", " + #DQUOTE$ + GetGadgetText(GadgetsList()\id) + #DQUOTE$ + ")" + #CRLF$
					EndSelect
					n + 1
				EndIf
			Next
			const$ = Left(const$, Len(const$) - 2)
			Event$ = Left(Event$, Len(Event$) - 2)
			If template
				code$ = OpenFileRequester(Lng(38), GetCurrentDirectory() + "template.pb", "*.pb|*.pb", 0)
				If Asc(code$)
					code$ = ReadFileToVar(code$)
				EndIf
			EndIf
			
			If Asc(code$)
				code$ = ReplaceString(code$, "%c", const$)
				code$ = ReplaceString(code$, "%g", "; OpenWindow(0, 0,0, " + Str(GadgetWidth(#lg)) + ", " + Str(GadgetHeight(#lg)) + #CRLF$ + Gadgets$)
				code$ = ReplaceString(code$, "%e", Event$)
			Else
				code$ = "EnableExplicit" + #CRLF$ + #CRLF$
				        
				If pb_any
					code$ + const$ + #CRLF$
				Else
					code$ + "Enumeration" + #CRLF$ + const$ + #CRLF$ + "EndEnumeration" + #CRLF$
				EndIf
				If iconRequired
					code$ + #CRLF$
					code$ + "Define icon" + #CRLF$
					code$ + "ExtractIconEx_(" + #DQUOTE$ + "Shell32.dll" + #DQUOTE$ + ", 3, 0, @icon, 1)" + #CRLF$
				EndIf
				code$ +  #CRLF$ + "OpenWindow(0, 0,0, " + Str(GadgetWidth(#lg)) + ", " + Str(GadgetHeight(#lg)) + ", " + #DQUOTE$ + "GUI example" + #DQUOTE$ + 
				         ", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)" +
				         #CRLF$ + #CRLF$ + Gadgets$ + #CRLF$ + "Repeat" + #CRLF$ + #TAB$ + "Select WaitWindowEvent()" + #CRLF$ + #TAB$ + #TAB$ +
				         "Case #PB_Event_Gadget" + #CRLF$ + #TAB$ + #TAB$ + #TAB$ + "Select EventGadget()" + #CRLF$ + Event$ + #CRLF$ +
				         #TAB$ + #TAB$ + #TAB$ + "EndSelect" + #CRLF$ + #TAB$ + #TAB$ + "Case #PB_Event_CloseWindow" + #CRLF$ +
				         #TAB$ + #TAB$ + #TAB$ + "CloseWindow(0)" + #CRLF$ +
				         #TAB$ + #TAB$ + #TAB$ + "End" + #CRLF$ +
				         #TAB$ + "EndSelect" + #CRLF$ + "ForEver"
			EndIf
			
			#File = 0
			If CreateFile(#File, Path$)
				WriteStringFormat(#File, #PB_UTF8)
				WriteString(#File, code$, #PB_UTF8)
				CloseFile(#File)
				If MessageRequester(Lng(39), code$, #PB_MessageRequester_YesNo) = #PB_MessageRequester_Yes
					RunProgram(Path$)
				EndIf
			EndIf
		EndIf
	Else
		MessageRequester("", Lng(40))
	EndIf
EndProcedure


Procedure AddGadget(item)
	Protected y, *element
	y = WindowHeight(#Window) - 100
	NG + 1
	id_Gadget + 1
	Select item
		Case #PB_GadgetType_Unknown
			ProcedureReturn
		Case #PB_GadgetType_Button
			ButtonGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_CheckBox
			CheckBoxGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_Editor
			EditorGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h)
			AddGadgetItem(id_Gadget, -1, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_Frame
			TextGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name, #SS_NOTIFY | #WS_BORDER)
		Case #PB_GadgetType_Text
			TextGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name, #SS_NOTIFY)
		Case #PB_GadgetType_String
			StringGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name)
			SetGadgetText(id_Gadget, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_ListView
			ListViewGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h)
			AddGadgetItem(id_Gadget, -1, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_ListIcon
			ListIconGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name, GadgetsTypeArray(item)\w)
			AddGadgetItem(id_Gadget, -1, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_ComboBox
			ComboBoxGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, #PB_ComboBox_Editable)
			SetGadgetText(id_Gadget, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_Option
			OptionGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_ExplorerCombo
			ExplorerComboGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, "C:\")
		Case #PB_GadgetType_Image
			iconRequired = 1
			TextGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name, #SS_NOTIFY)
			
			
			
		Case #PB_GadgetType_Web
			WebGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, "C:\")
		Case #PB_GadgetType_ExplorerList
			ExplorerListGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, "C:\")
		Case #PB_GadgetType_ExplorerTree
			ExplorerTreeGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, "C:\")
		Case #PB_GadgetType_Tree
			TreeGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h)
			AddGadgetItem(id_Gadget, -1, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_Calendar
			CalendarGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h)
		Case #PB_GadgetType_ButtonImage
			iconRequired = 1
			ButtonGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_Container
			ContainerGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, #PB_Container_Flat)
			CloseGadgetList()
		Case #PB_GadgetType_ScrollArea
			ScrollAreaGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, GadgetsTypeArray(item)\w + 20, GadgetsTypeArray(item)\h + 20, #PB_Container_Flat)
			CloseGadgetList()
		Case #PB_GadgetType_ScrollBar
			ScrollBarGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, 0, 100, 25)
		Case #PB_GadgetType_Date
			DateGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h)
		Case #PB_GadgetType_Canvas
			CanvasGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h)
		Case #PB_GadgetType_HyperLink
			HyperLinkGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, Str(NG) + " " + GadgetsTypeArray(item)\name, $FF0000)
		Case #PB_GadgetType_IPAddress
			IPAddressGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h)
		Case #PB_GadgetType_Spin
			SpinGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, 0, 1000)
		Case #PB_GadgetType_TrackBar
			TrackBarGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, 0, 100)
		Case #PB_GadgetType_Panel
			PanelGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h)
		Case #PB_GadgetType_ProgressBar
			ProgressBarGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, 0, 100)
		Case #PB_GadgetType_Scintilla
			ScintillaGadget(id_Gadget, 10, y, GadgetsTypeArray(item)\w, GadgetsTypeArray(item)\h, @ScintillaCallback())
		Default
			ProcedureReturn
	EndSelect
	

	*element = AddElement(GadgetsList())
	If *element And IsGadget(id_Gadget)
		SetGadgetData(id_Gadget, *element)
		GadgetsList()\id = id_Gadget
		GadgetsList()\type = item
		GadgetsList()\handle = GadgetID(id_Gadget)
		id_CurGadget = id_Gadget
		If id_Gadget = #FirstGadget
			PrevGadget = id_Gadget
		Else
			PrevGadget = id_Gadget - 1
		EndIf
		If autopos
			PosXY()
		Else
			SetTextCoor(id_CurGadget)
		EndIf
	EndIf
EndProcedure


Procedure SetTextCoor(g)
	SetGadgetText(#Coor, Str(GadgetX(g)) + ", " + Str(GadgetY(g)) + ", " + Str(GadgetWidth(g)) + ", " + Str(GadgetHeight(g)))
EndProcedure


Procedure Properties()
	Protected i = -10, id, j
	Protected count, Height, *element.GadgetsList
	If id_CurGadget < #FirstGadget
		ProcedureReturn 
	EndIf
	
	*element = GetGadgetData(id_CurGadget)
	count = ListSize(GadgetsTypeArray(*element\type)\Properties())
	If Not count
		ProcedureReturn 
	EndIf

	DisableWindow(#Window, 1)
	Height = count * 20 + 60
	
	OpenWindow(#Win1, 0, 0, 300, Height, Lng(26), #PB_Window_SystemMenu | #PB_Window_ScreenCentered, hGUI)
	id = #bf1
	ForEach GadgetsTypeArray(*element\type)\Properties()
		i + 20
		If id > #bfLast
			Break
		EndIf
		CheckBoxGadget(id, 10, i, 280, 20, GadgetsTypeArray(*element\type)\Properties())
		ForEach GadgetsList()\PropCheck()
			If GadgetsList()\PropCheck() = j
				SetGadgetState(id, #PB_Checkbox_Checked)
			EndIf
		Next
		id + 1
		j + 1
	Next
	
	ButtonGadget(#w1_btnOk, (300 - 70) / 2, Height - 40, 70, 28, "OK")

	Repeat
		Select WaitWindowEvent()
			Case #PB_Event_Gadget
				Select EventGadget()
					Case #w1_btnOk
						id = #bf1
						j = 0
						ClearList(GadgetsList()\PropCheck())
						ForEach GadgetsTypeArray(*element\type)\Properties()
							If GetGadgetState(id) & #PB_Checkbox_Checked
								AddElement(GadgetsList()\PropCheck())
								GadgetsList()\PropCheck() = j
							EndIf
							id + 1
							j + 1
						Next
						Break
				EndSelect
			Case #PB_Event_CloseWindow
				Break
		EndSelect
	ForEver
	
	id = #bf1
	ForEach GadgetsTypeArray(*element\type)\Properties()
		FreeGadget(id)
		id + 1
	Next

	DisableWindow(#Window, 0)
	CloseWindow(#Win1)
	
	SetActiveWindow(#Window)
	UseGadgetList(WindowID(#Window))
EndProcedure


Procedure Copy()
	Protected *element.GadgetsList
	Protected code$, flags$
	
	If id_CurGadget < #FirstGadget
		ProcedureReturn 
	EndIf
	
	*element = GetGadgetData(id_CurGadget)
	ChangeCurrentElement(GadgetsList() , *element)

	If GadgetsList()\id = id_CurGadget And IsGadget(GadgetsList()\id)
		If ListSize(GadgetsList()\PropCheck())
			flags$ + ", "
			ForEach GadgetsList()\PropCheck()
				SelectElement(GadgetsTypeArray(GadgetsList()\type)\Properties(), GadgetsList()\PropCheck())
				flags$ + GadgetsTypeArray(GadgetsList()\type)\Properties() + " | "
			Next
			flags$ = Left(flags$, Len(flags$) - 3)
		EndIf
		code$ + GadgetsTypeArray(GadgetsList()\type)\name + "Gadget(#" + GadgetsTypeArray(GadgetsList()\type)\const + ", " + Str(GadgetX(GadgetsList()\id)) + ", " + Str(GadgetY(GadgetsList()\id)) + ", " + Str(GadgetWidth(GadgetsList()\id)) + ", " + Str(GadgetHeight(GadgetsList()\id))
		Select GadgetsList()\type
			Case #PB_GadgetType_ComboBox, #PB_GadgetType_Editor, #PB_GadgetType_ListView, #PB_GadgetType_ExplorerCombo, #PB_GadgetType_Tree, #PB_GadgetType_Calendar, #PB_GadgetType_ScrollBar, #PB_GadgetType_Date, #PB_GadgetType_Canvas, #PB_GadgetType_IPAddress, #PB_GadgetType_Panel
				code$ + flags$ + ")" + #CRLF$
			Case #PB_GadgetType_ListIcon
				code$ + ", " + #DQUOTE$ + GetGadgetText(GadgetsList()\id) + #DQUOTE$ + ", " + Str(GadgetWidth(GadgetsList()\id)) + flags$ + ")" + #CRLF$
			Case #PB_GadgetType_Web, #PB_GadgetType_ExplorerList, #PB_GadgetType_ExplorerTree
				code$ + ", " + #DQUOTE$ + "C:\" + #DQUOTE$ + ")" + #CRLF$
			Case #PB_GadgetType_ProgressBar, #PB_GadgetType_Spin, #PB_GadgetType_TrackBar, #PB_GadgetType_ScrollBar
				code$ + ", 0, 100" + flags$ + ")" + #CRLF$
			Case #PB_GadgetType_HyperLink
				code$ + ", " + #DQUOTE$ + GetGadgetText(GadgetsList()\id) + #DQUOTE$ + ", $FF0000)" + #CRLF$
			Default 
				code$ + ", " + #DQUOTE$ + GetGadgetText(GadgetsList()\id) + #DQUOTE$ + ")" + #CRLF$
		EndSelect
				
				
		SetClipboardText(code$)
		
	EndIf
EndProcedure


Procedure EnumChildProc(hwnd.l, *hwnd)
	Protected rc.RECT
	Protected tmp${256}
	If IsWindowVisible_(hwnd) And Not IsIconic_(hwnd)
		GetClassName_(hwnd, @tmp$, 256)
		If tmp$ <> "CabinetWClass"
			GetWindowText_(hwnd, @tmp$, 256)
			If Asc(tmp$)
				If tmp$ <> "Microsoft Edge" And tmp$ <> "Program Manager" And tmp$ <> "CreationGuiPB"
					AddElement(WinPos())
					GetWindowRect_(hwnd, @rc)
					WinPos()\x = rc\left + delta
					WinPos()\y = rc\top
				EndIf
			EndIf
		EndIf
	EndIf
	ProcedureReturn 1
EndProcedure


Procedure WinCallback(hWnd, uMsg, WParam, LParam)
	Protected value, x, y
	Protected *element.GadgetsList
	
	value = WParam >> 16

	Select uMsg
		Case #WM_ENTERSIZEMOVE
			If magnet
				EnumWindows_(@EnumChildProc(), @hwnd)
			EndIf
		Case #WM_MOVE
			If magnet
				x = WindowX(#Window)
				y = WindowY(#Window)

				ForEach WinPos()
					If Abs(WinPos()\x - x) < 15.0 And Abs(WinPos()\y - y) < 15.0
						ResizeWindow(#Window, WinPos()\x, WinPos()\y, #PB_Ignore, #PB_Ignore)
						Break
					EndIf
				Next
			EndIf

		Case #WM_VSCROLL
			Select LParam
				Case GadgetID(#TrackBarV)
					If id_CurGadget > #BeforeFirstGadget And value > 2
						*element = GetGadgetData(id_CurGadget)
						ResizeGadget(id_CurGadget, #PB_Ignore, #PB_Ignore, #PB_Ignore, GadgetsTypeArray(*element\type)\h * Val(GetGadgetText(#Spin0)) * value / 50)
						SetTextCoor(id_CurGadget)
					EndIf
				Case GadgetID(#TrackBarTrans)
					If GetGadgetState(#chTrans) & #PB_Checkbox_Checked And value > 2
						SetLayeredWindowAttributes_(hGUI, #BackColor, 255 - value, 2)
					EndIf
			EndSelect
		Case #WM_HSCROLL
			If id_CurGadget > #BeforeFirstGadget And value > 2
				*element = GetGadgetData(id_CurGadget)
				ResizeGadget(id_CurGadget, #PB_Ignore, #PB_Ignore, GadgetsTypeArray(*element\type)\w * Val(GetGadgetText(#Spin1)) * value / 50, #PB_Ignore)
				SetTextCoor(id_CurGadget)
			EndIf
	EndSelect

    ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure


Procedure SizeWindowHandler()
	cw = WindowWidth(#Window)
	ch = WindowHeight(#Window)

	ResizeGadget(#lg, #PB_Ignore, #PB_Ignore, cw - 220, ch - 110)
	ResizeGadget(#lvg, cw - 125, #PB_Ignore, #PB_Ignore, ch - 180)
	ResizeGadget(#txt5, cw - 218, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#Coor, cw - 174, #PB_Ignore, #PB_Ignore, #PB_Ignore)

	ResizeGadget(#txt1, cw - 210, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#txt2, cw - 210, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#txt3, cw - 210, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#txt4, cw - 210, #PB_Ignore, #PB_Ignore, #PB_Ignore)

	ResizeGadget(#StrX, cw - 175, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#StrY, cw - 175, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#StrW, cw - 175, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#StrH, cw - 175, #PB_Ignore, #PB_Ignore, #PB_Ignore)

	ResizeGadget(#chAutoPos, cw - 205, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#PosXY, cw - 180, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#SetWH, cw - 180, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#btnMenu, cw - 158, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	
	ResizeGadget(#btnSave, cw - 55, ch - 115, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#btnCopy, cw - 55, ch - 140, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#chTrans, cw - 70, ch - 90, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#chStyle, cw - 70, ch - 65, #PB_Ignore, #PB_Ignore)

	ResizeGadget(#TrackBarH, cw - 190, ch - 25, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#TrackBarV, cw - 190, ch - 180, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#TrackBarTrans, cw - 100, ch - 150, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#Spin0, cw - 160, ch - 109, #PB_Ignore, #PB_Ignore)
	ResizeGadget(#Spin1, cw - 160, ch - 76, #PB_Ignore, #PB_Ignore)

	ForEach GadgetsList()
		ResizeGadget(GadgetsList()\id, #PB_Ignore, #PB_Ignore, #PB_Ignore, #PB_Ignore)
	Next
EndProcedure


Procedure PosXY()
	Protected x, y, w, h, xx, yy
	If id_CurGadget = #FirstGadget
		ResizeGadget(id_CurGadget, 10, 10, #PB_Ignore, #PB_Ignore)
	ElseIf id_CurGadget > #FirstGadget
		While Not IsGadget(PrevGadget) And PrevGadget > #BeforeFirstGadget
			PrevGadget - 1
		Wend
		If PrevGadget < #FirstGadget
			ProcedureReturn
		EndIf
		x = GadgetX(PrevGadget)
		y = GadgetY(PrevGadget)
		w = GadgetWidth(PrevGadget)
		h = GadgetHeight(PrevGadget)
		xx = Val(GetGadgetText(#StrX))
		yy = Val(GetGadgetText(#StrY))
		If xx
			ResizeGadget(id_CurGadget, x + xx + w, y, #PB_Ignore, #PB_Ignore)
		ElseIf yy
			ResizeGadget(id_CurGadget, x, y + yy + h, #PB_Ignore, #PB_Ignore)
		EndIf
	EndIf
	If id_CurGadget > #BeforeFirstGadget
		SetTextCoor(id_CurGadget)
	EndIf
EndProcedure


Procedure SplitL(String.s, List StringList.s(), Separator.s = " ")

	Protected S.String, *S.Integer = @S
	Protected.i p, slen
	slen = Len(Separator)
	ClearList(StringList())

	*S\i = @String
	Repeat
		AddElement(StringList())
		p = FindString(S\s, Separator)
		StringList() = PeekS(*S\i, p - 1)
		*S\i + (p + slen - 1) << #PB_Compiler_Unicode
	Until p = 0
	*S\i = 0

EndProcedure


Procedure GetGadgetPB(Handle)
	ForEach GadgetsList()
		If GadgetsList()\handle = Handle
			ProcedureReturn GadgetsList()\id
		EndIf
	Next
	ProcedureReturn 0
EndProcedure

Procedure moveLR(shift)
	Protected x
	x = GadgetX(id_CurGadget) + shift
	ResizeGadget(id_CurGadget, x, #PB_Ignore, #PB_Ignore , #PB_Ignore)
	SetTextCoor(id_CurGadget)
EndProcedure

Procedure moveVN(shift)
	Protected y
	y = GadgetY(id_CurGadget) + shift
	ResizeGadget(id_CurGadget, #PB_Ignore, y, #PB_Ignore , #PB_Ignore)
	SetTextCoor(id_CurGadget)
EndProcedure

Procedure moveLR1(shift)
	Protected w
	w = GadgetWidth(id_CurGadget) + shift
	ResizeGadget(id_CurGadget, #PB_Ignore, #PB_Ignore, w , #PB_Ignore)
	SetTextCoor(id_CurGadget)
EndProcedure

Procedure moveVN1(shift)
	Protected h
	h = GadgetHeight(id_CurGadget) + shift
	ResizeGadget(id_CurGadget, #PB_Ignore, #PB_Ignore, #PB_Ignore, h)
	SetTextCoor(id_CurGadget)
EndProcedure

Procedure moveLR2(shift)
	ResizeWindow(#Window, WindowX(#Window) + shift - delta, #PB_Ignore, #PB_Ignore, #PB_Ignore)
EndProcedure

Procedure moveVN2(shift)
	ResizeWindow(#Window, #PB_Ignore, WindowY(#Window) + shift, #PB_Ignore, #PB_Ignore)
EndProcedure

ProcedureDLL ScintillaCallBack(Gadget, *scinotify.SCNotification)
EndProcedure

Procedure AddGadget2(item, *rc.RECT, title$)
	Protected y, *element
	y = WindowHeight(#Window) - 100
	NG + 1
	id_Gadget + 1
	Select item
		Case #PB_GadgetType_Unknown
			TextGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$, #SS_NOTIFY | #WS_BORDER)
		Case #PB_GadgetType_Button
			ButtonGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$)
		Case #PB_GadgetType_CheckBox
			CheckBoxGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$)
		Case #PB_GadgetType_Editor
			EditorGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom)
			AddGadgetItem(id_Gadget, -1, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_Frame
			TextGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$, #SS_NOTIFY | #WS_BORDER)
		Case #PB_GadgetType_Text, #PB_GadgetType_Image
			TextGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$, #SS_NOTIFY)
		Case #PB_GadgetType_String
			StringGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$)
			SetGadgetText(id_Gadget, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_ListView, #PB_GadgetType_ExplorerList
			ListViewGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom)
			AddGadgetItem(id_Gadget, -1, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_ListIcon
			ListIconGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$, GadgetsTypeArray(item)\w)
			AddGadgetItem(id_Gadget, -1, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_ComboBox, #PB_GadgetType_ExplorerCombo
			ComboBoxGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, #PB_ComboBox_Editable)
			SetGadgetText(id_Gadget, Str(NG) + " " + GadgetsTypeArray(item)\name)
		Case #PB_GadgetType_Option
			OptionGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$)
		Case #PB_GadgetType_Tree, #PB_GadgetType_ExplorerTree
			TreeGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom)
		Case #PB_GadgetType_Calendar
			CalendarGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom)
		Case #PB_GadgetType_ButtonImage
			ButtonGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$)
		Case #PB_GadgetType_Container
			ContainerGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom)
		Case #PB_GadgetType_Date
			DateGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom)
		Case #PB_GadgetType_Canvas
			CanvasGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom)
		Case #PB_GadgetType_HyperLink
			HyperLinkGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, title$, $FF0000)
		Case #PB_GadgetType_IPAddress
			IPAddressGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom)
		Case #PB_GadgetType_Spin
			SpinGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, 0, 1000)
		Case #PB_GadgetType_TrackBar
			TrackBarGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, 0, 100)
		Case #PB_GadgetType_Panel
			PanelGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom)
		Case #PB_GadgetType_ProgressBar
			ProgressBarGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, 0, 100)
		Case #PB_GadgetType_Scintilla
			TextGadget(id_Gadget, *rc\left, *rc\top, *rc\right, *rc\bottom, Str(NG) + " " + title$, #SS_NOTIFY | #WS_BORDER)

	EndSelect




	*element = AddElement(GadgetsList())
	If *element And IsGadget(id_Gadget)
		SetGadgetData(id_Gadget, *element)
		GadgetsList()\id = id_Gadget
		GadgetsList()\type = item
		GadgetsList()\handle = GadgetID(id_Gadget)
		id_CurGadget = id_Gadget
		If id_Gadget = #FirstGadget
			PrevGadget = id_Gadget
		Else
			PrevGadget = id_Gadget - 1
		EndIf
	EndIf
EndProcedure


Procedure SetForegroundWindow(hWnd)
    Protected foregroundThreadID, ourThreadID
    If GetWindowLong_(hWnd, #GWL_STYLE) & #WS_MINIMIZE
        ShowWindow_(hWnd, #SW_SHOWNOACTIVATE)
        UpdateWindow_(hWnd)
    EndIf
    foregroundThreadID = GetWindowThreadProcessId_(GetForegroundWindow_(), 0)
    ourThreadID = GetCurrentThreadId_()

    If (foregroundThreadID <> ourThreadID)
        AttachThreadInput_(foregroundThreadID, ourThreadID, #True)
    EndIf

    SetForegroundWindow_(hWnd)

    If (foregroundThreadID <> ourThreadID)
        AttachThreadInput_(foregroundThreadID, ourThreadID, #False)
    EndIf

    InvalidateRect_(hWnd, #Null, #True)
EndProcedure


Procedure EnumWindows(hwnd.l, *hwnd)
	Protected rc.RECT
	Protected classText${256}
	If IsWindowVisible_(hwnd)
		GetClassName_(hwnd, @classText$, 256)
		If classText$ <> "CabinetWClass"
			GetWindowText_(hwnd, @classText$, 256)
			If Asc(classText$)
				If g_tmp$ = LCase(Left(classText$, Len(g_tmp$)))
					If IsIconic_(hwnd)
						SetForegroundWindow(hwnd)
					EndIf
					GetWindowRect_(hwnd, @rc)
					rc\right - rc\left
					rc\bottom - rc\top
					If GadgetHeight(#lg) < rc\right Or GadgetWidth(#lg) < rc\bottom
						ResizeWindow(#Window, #PB_Ignore, #PB_Ignore, rc\right + 190, rc\bottom + 110)
					EndIf
					PokeI(*hwnd, hwnd)
					ProcedureReturn 0
				EndIf
			EndIf
		EndIf
	EndIf
	ProcedureReturn 1
EndProcedure


Procedure EnumGadgets(hwnd.l, *hparent)
	Protected rc.RECT
	Protected class${256}
	Protected title${256}
	Protected style
	If IsWindowVisible_(hwnd)
		GetClassName_(hwnd, @class$, 256)
		GetWindowText_(hwnd, @title$, 256)
		If Asc(class$)
			GetWindowRect_(hwnd, @rc)
			rc\right - rc\left
			rc\bottom - rc\top
			ScreenToClient_(PeekI(*hparent), @rc)
			style = GetWindowLongPtr_(hwnd, #GWL_STYLE)
			Select class$
				Case  "Button"
					If style & #BS_PUSHLIKE
						AddGadget2(#PB_GadgetType_Button, @rc, title$)
					ElseIf style & #BS_CHECKBOX Or style & #BS_AUTO3STATE Or style & #BS_AUTOCHECKBOX
						AddGadget2(#PB_GadgetType_CheckBox, @rc, title$)
					ElseIf style & #BS_AUTORADIOBUTTON
						AddGadget2(#PB_GadgetType_Option, @rc, title$)
					ElseIf style & #BS_GROUPBOX
						AddGadget2(#PB_GadgetType_Frame, @rc, title$)
					Else
						AddGadget2(#PB_GadgetType_Button, @rc, title$)
					EndIf
					
				Case  "Static"
					AddGadget2(#PB_GadgetType_Text, @rc, title$)
					If style & #BS_GROUPBOX
						AddGadget2(#PB_GadgetType_Frame, @rc, title$)
					ElseIf style & #BS_AUTORADIOBUTTON
						AddGadget2(#PB_GadgetType_Option, @rc, title$)
					ElseIf style & #BS_CHECKBOX Or style & #BS_AUTO3STATE Or style & #BS_AUTOCHECKBOX
						AddGadget2(#PB_GadgetType_CheckBox, @rc, title$)
					Else
						AddGadget2(#PB_GadgetType_Button, @rc, title$)
					EndIf
				Case  "Edit"
					If rc\bottom > 30
						AddGadget2(#PB_GadgetType_Editor, @rc, title$)
					Else
						AddGadget2(#PB_GadgetType_String, @rc, title$)
					EndIf
				Case  "SysListView32"
					AddGadget2(#PB_GadgetType_ListIcon, @rc, title$)
				Case  "SysTabControl32"
					AddGadget2(#PB_GadgetType_Panel, @rc, title$)
				Case  "ListBox"
					AddGadget2(#PB_GadgetType_ListView, @rc, title$)
				Case  "ComboBox"
					AddGadget2(#PB_GadgetType_ComboBox, @rc, title$)
				Case  "msctls_trackbar32"
					AddGadget2(#PB_GadgetType_TrackBar, @rc, title$)
				Case  "SysTreeView32"
					AddGadget2(#PB_GadgetType_Tree, @rc, title$)
				Case  "SysAnimate32"
					AddGadget2(#PB_GadgetType_Unknown, @rc, title$)
				Case  "SysDateTimePick32"
					AddGadget2(#PB_GadgetType_Date, @rc, title$)
				Case  "msctls_updown32"
					AddGadget2(#PB_GadgetType_Spin, @rc, title$)
				Case  "SysMonthCal32"
					AddGadget2(#PB_GadgetType_Calendar, @rc, title$)
				Case  "msctls_progress32"
					AddGadget2(#PB_GadgetType_ProgressBar, @rc, title$)
				Case  "ComboBoxEx32"
					AddGadget2(#PB_GadgetType_ComboBox, @rc, title$)
				Case  "SysIPAddress32"
					AddGadget2(#PB_GadgetType_IPAddress, @rc, title$)
				Case  "ReBarWindow32"
					AddGadget2(#PB_GadgetType_Unknown, @rc, title$)
				Case  "msctls_statusbar32"
					AddGadget2(#PB_GadgetType_StatusBar, @rc, title$)
				Case  "ToolbarWindow32"
					AddGadget2(#PB_GadgetType_ToolBar, @rc, title$)
				Case  "RICHEDIT50W"
					AddGadget2(#PB_GadgetType_Editor, @rc, title$)
				Default
					If FindString(class$, "Button")
						AddGadget2(#PB_GadgetType_Button, @rc, title$)
					ElseIf FindString(class$, "Scintilla")
						title$ = "Scintilla"
						AddGadget2(#PB_GadgetType_Scintilla, @rc, title$)
					ElseIf FindString(class$, "RICHEDIT")
						AddGadget2(#PB_GadgetType_Editor, @rc, title$)
					ElseIf FindString(class$, "Edit")
						If rc\bottom > 30
							AddGadget2(#PB_GadgetType_Editor, @rc, title$)
						Else
							AddGadget2(#PB_GadgetType_String, @rc, title$)
						EndIf
					EndIf
			EndSelect
		EndIf
	EndIf
	ProcedureReturn 1
EndProcedure


Structure GadgetsTypes
	name.s
	type.i
EndStructure

Procedure WinCapture()
	Protected hwnd
	
	g_tmp$ = InputRequester(Lng(23), Lng(41), "")
	If Not Asc(g_tmp$)
		ProcedureReturn
	EndIf
	g_tmp$ = LCase(g_tmp$)
	
	
	EnumWindows_(@EnumWindows(), @hwnd)
	If hwnd
		EnumChildWindows_(hwnd, @EnumGadgets(), @hwnd)
		ForEach GadgetsList()
			If IsGadget(GadgetsList()\id)
				ResizeGadget(GadgetsList()\id, #PB_Ignore, #PB_Ignore, #PB_Ignore, #PB_Ignore)
			EndIf
		Next
	EndIf
EndProcedure
Last edited by AZJIO on Wed Dec 11, 2024 11:17 am, edited 14 times in total.
BarryG
Addict
Addict
Posts: 4159
Joined: Thu Apr 18, 2019 8:17 am

Re: CreationGuiPB

Post by BarryG »

Can't help, but I looked at your video and was wondering how you added those extra icons to the IDE's toolbar? I see no way to do that?

Image
AZJIO
Addict
Addict
Posts: 2154
Joined: Sun May 14, 2017 1:48 am

Re: CreationGuiPB

Post by AZJIO »

viewtopic.php?p=581935#p581935

You can also edit the PureBasic.prefs configuration file. But before that, all these tools must be added to the "Tools" menu. In the configuration file, the number of tools must be changed, that is, the number 34 must correspond to the number. And the names must match exactly as on the menu.

Code: Select all

[ToolbarNew]
ItemCount = 34
.......

Icon_26 = External:C:\PB\Tools\icon\AkelPad.ico
Action_26 = Tool:AkelPad
Icon_27 = External:C:\PB\Tools\icon\RegExpPB.ico
Action_27 = Tool:RegExpPB
Icon_28 = External:C:\PB\Tools\icon\launcher.ico
Action_28 = Tool:LauncherPB
Icon_29 = External:C:\PB\Tools\icon\folder.ico
Action_29 = Tool:Open in folder (Ctrl+E)
Icon_30 = External:C:\PB\Tools\icon\tidy.ico
Action_30 = Tool:Tidy
Icon_31 = External:C:\PB\Tools\icon\AnotherFileNearby.ico
Action_31 = Tool:Old versions (backup)
Icon_32 = External:C:\PB\Tools\icon\IncludeHelper.ico
Action_32 = Tool:IncludeHelper
Icon_33 = External:C:\PB\Tools\icon\no_comment.ico
Action_33 = Tool:no_comment
Icon_34 = External:C:\PB\Tools\icon\TextReplace.ico
Action_34 = Tool:TextReplace
Or download ready
BarryG
Addict
Addict
Posts: 4159
Joined: Thu Apr 18, 2019 8:17 am

Re: CreationGuiPB

Post by BarryG »

Oh, I even replied there but totally forgot about it until now (it was 2 years ago). :oops: Time to start playing with it.
AZJIO
Addict
Addict
Posts: 2154
Joined: Sun May 14, 2017 1:48 am

Re: CreationGuiPB

Post by AZJIO »

Added style switching between black and white themes. The color is stored in an ini file.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: CreationGuiPB

Post by Kwai chang caine »

Like often W10 detect virus in exe :|
Another new approach of VD, personally i prefer when i can resize the element with the mouse :wink:
But thanks for sharing your works 8)
ImageThe happiness is a road...
Not a destination
AZJIO
Addict
Addict
Posts: 2154
Joined: Sun May 14, 2017 1:48 am

Re: CreationGuiPB

Post by AZJIO »

Kwai chang caine wrote: Wed Dec 11, 2024 6:20 pm Another new approach of VD, personally i prefer when i can resize the element with the mouse :wink:
Done.
I like it better that the elements automatically adjust to the previous element, and with the keys right, left, up, down I can do fine-tuning.
Kwai chang caine wrote: Wed Dec 11, 2024 6:20 pm Like often W10 detect virus in exe :|
I use Kaspersky anti-virus, it is less categorical, and does not call everything a virus in a row, like Windows.
There are 3 types of files (AutoIt3, CreationGuiPB, CreationGuiPB-Canvas), does it complain about everything?

Updated
Added an optional marker indicating whether the operation will drag an element, move sides or move a corner.
Added the ability to resize an element with the mouse.
Improved appearance of Date, TrackBar, HyperLink, CheckBox gadgets.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: CreationGuiPB

Post by Kwai chang caine »

Thanks for adding size and move with mouse :wink:
I have tested Canvas version and i prefer this behaviour 8)
ImageThe happiness is a road...
Not a destination
AZJIO
Addict
Addict
Posts: 2154
Joined: Sun May 14, 2017 1:48 am

Re: CreationGuiPB

Post by AZJIO »

Added "Cancel" (Ctrl+Z). Returns the size change. There is no queue, cancels only once (back and forth).
Post Reply