; --------------------------------------------------------------------------------------------; Copyright (c) Fantaisie Software and Gaetan DUPONT-PANON. All rights reserved.; Dual licensed under the GPL and Fantaisie Software licenses.; See LICENSE and LICENSE-FANTAISIE in the project root for license information.; --------------------------------------------------------------------------------------------Procedure.s FD_SelectCode(contentonly = 0, testcode = 0)If Not contentonly; HideGadget(#Form_ContDraw,1); DisableGadget(#Form_ContDraw,1); HideGadget(#Form_ContCode,0); DisableGadget(#Form_ContCode,0); TE_ClearGadgetItems(code_gadget)EndIfCleanImageList()firstwindow = 1NewList ContainerLevel.i()NewList Procs.s()NewList Img.FormImg()NewList Fonts.fontlist()NewList MenuVars.twostring()windowvar.s = "" : gadgetvar.s = "" : imgvar.s = ""windowenum.s = "" : gadgetenum.s = "" : imgenum.s = ""menuenum.s = ""cust_gadget_init.s = ""imagecount.i = 0toolbarcount = 0statusbarcount = 0fontcount = 0scintilla = 0codegenresize = 0If FormWindows()\pbanyIf windowvar <> ""windowvar + ", "EndIfwindowvar + FormWindows()\variableElsewindowenum + " #" + FormWindows()\variable + #EndlineEndIfForEach FormWindows()\FormMenus()If FormWindows()\FormMenus()\id <> ""menuenum + " " + FormWindows()\FormMenus()\id + #EndlineAddElement(MenuVars())MenuVars()\a = FormWindows()\FormMenus()\idMenuVars()\b = FormWindows()\FormMenus()\eventEndIfNextForEach FormWindows()\FormGadgets()If FormWindows()\FormGadgets()\type = #Form_Type_Scintillascintilla = 1EndIfIf FormWindows()\FormGadgets()\pbanyIf gadgetvar <> ""gadgetvar + ", "EndIfgadgetvar + FormWindows()\FormGadgets()\variableElsegadgetenum + " #" + FormWindows()\FormGadgets()\variable + #EndlineEndIfIf FormWindows()\FormGadgets()\cust_init <> ""cust_gadget_init + "; " + Str(ListIndex(FormWindows()\FormGadgets())) + " Custom gadget initialisation (do Not remove this line)" + #Endline + FormWindows()\FormGadgets()\cust_init + #EndlineEndIfIf FormWindows()\FormGadgets()\gadgetfont <> ""found = 0ForEach Fonts()If Fonts()\flags = FormWindows()\FormGadgets()\gadgetfontflags And Fonts()\name = FormWindows()\FormGadgets()\gadgetfont And Fonts()\size = FormWindows()\FormGadgets()\gadgetfontsizefound = 1BreakEndIfNextIf Not foundAddElement(Fonts())Fonts()\flags = FormWindows()\FormGadgets()\gadgetfontflagsFonts()\name = FormWindows()\FormGadgets()\gadgetfontFonts()\size = FormWindows()\FormGadgets()\gadgetfontsizeFonts()\id = "#Font_" + FormWindows()\variable + "_" + Str(fontcount)fontcount + 1EndIfEndIfNextForEach FormWindows()\FormToolbars()If FormWindows()\FormToolbars()\id <> ""searchduplicate = 0ForEach FormWindows()\FormMenus()If FormWindows()\FormToolbars()\id = FormWindows()\FormMenus()\idsearchduplicate = 1If FormWindows()\FormToolbars()\event <> ""ForEach MenuVars()If MenuVars()\a = FormWindows()\FormToolbars()\idIf MenuVars()\b = ""MenuVars()\b = FormWindows()\FormToolbars()\eventEndIfBreakEndIfNextEndIfBreakEndIfNextIf Not searchduplicate And Not FormWindows()\FormToolbars()\separatormenuenum + " " + FormWindows()\FormToolbars()\id + #EndlineLastElement(MenuVars())AddElement(MenuVars())MenuVars()\a = FormWindows()\FormToolbars()\idMenuVars()\b = FormWindows()\FormToolbars()\eventEndIfEndIfNextForEach FormWindows()\FormImg()AddElement(Img())Img()\img = FormWindows()\FormImg()\imgIf FormWindows()\FormImg()\pbanyImg()\id = "Img_" + FormWindows()\variable + "_" + Str(ListIndex(FormWindows()\FormImg()))If imgvar <> ""imgvar + ", "EndIfimgvar + Img()\idElseImg()\id = "#Img_" + FormWindows()\variable + "_" + Str(ListIndex(FormWindows()\FormImg()))imgenum + " " + Img()\id + #EndlineEndIfImg()\inline = FormWindows()\FormImg()\inlineImg()\pbany = FormWindows()\FormImg()\pbanyNextcontent.s = ";" + #Endline +"; This code is automatically generated by the Form Designer." + #Endline +"; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled." + #Endline +"; Event procedures need to be put in another source file." + #Endline +";" + #Endline + #EndlineIf windowvar <> ""content + "Global "+windowvar + #Endlinecontent + "" + #EndlineEndIfIf gadgetvar <> ""content + "Global "+gadgetvar + #Endlinecontent + "" + #EndlineEndIfIf imgvar <> ""content + "Global "+imgvar + #Endlinecontent + "" + #EndlineEndIfIf windowenum <> ""content + "Enumeration FormWindow" + #Endlinecontent + windowenumcontent + "EndEnumeration" + #Endlinecontent + "" + #EndlineEndIfIf gadgetenum <> ""content + "Enumeration FormGadget" + #Endlinecontent + gadgetenumcontent + "EndEnumeration" + #Endlinecontent + "" + #EndlineEndIfIf menuenum <> ""content + "Enumeration FormMenu" + #Endlinecontent + menuenumcontent + "EndEnumeration" + #Endlinecontent + "" + #EndlineEndIfIf imgenum <> ""content + "Enumeration FormImage" + #Endlinecontent + imgenumcontent + "EndEnumeration" + #Endlinecontent + "" + #EndlineEndIfnum = CountString(cust_gadget_init,#Endline)If numFor i = 1 To numcontent + StringField(cust_gadget_init,i,#Endline) + #EndlineNextcontent + "" + #EndlineEndIfIf ListSize(Img());check if image decoder is requiredjpgdecoder.b = 0 : pngdecoder.b = 0 : tgadecoder.b = 0 : tiffdecoder.b = 0ForEach Img()img.s = LCase(Img()\img)If Not jpgdecoder And (FindString(img,"jpg") Or FindString(img,"jpeg"))jpgdecoder = 1EndIfIf Not pngdecoder And (FindString(img,"png"))pngdecoder = 1EndIfIf Not tgadecoder And (FindString(img,"tga"))tgadecoder = 1EndIfIf Not tiffdecoder And (FindString(img,"tiff"))tiffdecoder = 1EndIfNextIf jpgdecodercontent + "UseJPEGImageDecoder()" + #EndlineEndIfIf pngdecodercontent + "UsePNGImageDecoder()" + #EndlineEndIfIf tgadecodercontent + "UseJTAImageDecoder()" + #EndlineEndIfIf tiffdecodercontent + "UseTIFFImageDecoder()" + #EndlineEndIfIf jpgdecoder Or pngdecoder Or tgadecoder Or tiffdecodercontent + "" + #EndlineEndIf; load imagesForEach Img()If Img()\pbanyIf Img()\inlineimage_id.s = Img()\idIf Left(image_id, 1) = "#"image_id = Right(image_id, Len(image_id) - 1)EndIfcontent + Img()\id + " = CatchImage(#PB_Any,?" + image_id + ")" + #EndlineElsecontent + Img()\id + " = LoadImage(#PB_Any,"+Chr(34)+Img()\img+Chr(34)+")" + #EndlineEndIfElseIf Img()\inlineimage_id.s = Img()\idIf Left(image_id, 1) = "#"image_id = Right(image_id, Len(image_id) - 1)EndIfcontent + "CatchImage("+Img()\id+",?" + image_id + ")" + #EndlineElsecontent + "LoadImage("+Img()\id+","+Chr(34)+Img()\img+Chr(34)+")" + #EndlineEndIfEndIfNextcontent +"" + #EndlineEndIfIf ListSize(Fonts()); enumeration of font IDcontent +"Enumeration FormFont" + #EndlineForEach Fonts()content +" "+Fonts()\id + #EndlineNextcontent +"EndEnumeration" + #Endlinecontent +"" + #Endline; load fontsForEach Fonts()flags.s = ""If Fonts()\flags & FlagValue("#PB_Font_Bold")flags + "#PB_Font_Bold"EndIfIf Fonts()\flags & FlagValue("#PB_Font_Italic")If flags <> ""flags + " | "EndIfflags + "#PB_Font_Italic"EndIfIf Fonts()\flags & FlagValue("#PB_Font_StrikeOut")If flags <> ""flags + " | "EndIfflags + "#PB_Font_StrikeOut"EndIfIf Fonts()\flags & FlagValue("#PB_Font_Underline")If flags <> ""flags + " | "EndIfflags + "#PB_Font_Underline"EndIfIf flags <> ""flags = ", " + flagsEndIfcontent + "LoadFont("+Fonts()\id+","+Chr(34)+Fonts()\name+Chr(34)+", "+Str(Fonts()\size)+flags+")" + #EndlineNextcontent +"" + #EndlineEndIfForEach FormWindows()\FormGadgets(); only declare callbacks for scintilla if user press run so that form can still be tested.If FormWindows()\FormGadgets()\type = #Form_Type_Scintilla And testcodeIf FormWindows()\FormGadgets()\caption <> "" And FormWindows()\FormGadgets()\caption <> "0"content +"ProcedureDLL "+Left(FormWindows()\FormGadgets()\caption,Len(FormWindows()\FormGadgets()\caption)-1)+"Gadget, *scinotify.SCNotification)" + #Endlinecontent +" " + #Endlinecontent +"EndProcedure" + #Endlinecontent +"" + #EndlineEndIfEndIfNextForEach FormWindows()\FormGadgets()If FormWindows()\FormGadgets()\lock_bottom Or FormWindows()\FormGadgets()\lock_rightcodegenresize = 1BreakEndIfNextIf codegenresizecontent + "Declare ResizeGadgets" + FormWindows()\variable + "()" + #Endline + #EndlineEndIf; Declare all event procedures; The map is used to easily remove duplicates, when a procedure is used for several gadgets.; MenusNewMap FormProcedures.s()ForEach MenuVars()If MenuVars()\b <> ""procedurestring.s = "Declare " + MenuVars()\b + "(Event)" + #EndlineFormProcedures(procedurestring) = procedurestringEndIfNextForEach FormProcedures()content + FormProcedures()NextClearMap(FormProcedures()); GadgetsForEach FormWindows()\FormGadgets()If FormWindows()\FormGadgets()\event_procprocedurestring.s = "Declare " + FormWindows()\FormGadgets()\event_proc + "(EventType)" + #EndlineFormProcedures(procedurestring) = procedurestringEndIfNextForEach FormProcedures()content + FormProcedures()NextClearMap(FormProcedures()); WindowIf FormWindows()\event_procprocedurestring.s = "Declare " + FormWindows()\event_proc + "(Event, Window)" + #EndlineFormProcedures(procedurestring) = procedurestringEndIfForEach FormProcedures()content + FormProcedures()NextClearMap(FormProcedures())content + #EndlineIf FormWindows()\pbanywinid.s = FormWindows()\variableElsewinid.s = "#"+FormWindows()\variableEndIfForEach ObjList()If ObjList()\window = @FormWindows()ForEach ContainerLevel()If ObjList()\level <= ContainerLevel()content + " CloseGadgetList()" + #EndlineDeleteElement(ContainerLevel())EndIfNextIf ObjList()\gadgetcodepaddingy.s = ""codepaddingheight.s = ""If ObjList()\level <= 1; add correct padding to gadget coordinates, only if they are in the window gadget listcodepaddingy.s = ""If ListSize(FormWindows()\FormMenus());codepaddingy + "MenuHeight()"codepaddingheight + " - MenuHeight()"EndIfIf ListSize(FormWindows()\FormToolbars())If codepaddingy <> ""codepaddingy + " + "EndIfcodepaddingy + "ToolBarHeight("+Str(toolbarcount - 1)+")"codepaddingheight + " - ToolBarHeight("+Str(toolbarcount - 1)+")"EndIfIf ListSize(FormWindows()\FormStatusbars())codepaddingheight + " - StatusBarHeight("+Str(statusbarcount - 1)+")"EndIfIf codepaddingy <> ""codepaddingy + " + "EndIfEndIfChangeCurrentElement(FormWindows()\FormGadgets(),ObjList()\gadget)If FormWindows()\FormGadgets()\type = #Form_Type_Customline.s = " "+FormWindows()\FormGadgets()\cust_createIf FormWindows()\FormGadgets()\pbanyline = ReplaceString(line,"%id%",FormWindows()\FormGadgets()\variable)Elseline = ReplaceString(line,"%id%","#"+FormWindows()\FormGadgets()\variable)EndIfline = ReplaceString(line,"%x%",Str(DesktopUnscaledX(FormWindows()\FormGadgets()\x1)))line = ReplaceString(line,"%y%",codepaddingy + Str(DesktopUnscaledY(FormWindows()\FormGadgets()\y1)))line = ReplaceString(line,"%w%",Str(DesktopUnscaledX(FormWindows()\FormGadgets()\x2 - FormWindows()\FormGadgets()\x1)))line = ReplaceString(line,"%h%",Str(DesktopUnscaledY(FormWindows()\FormGadgets()\y2 - FormWindows()\FormGadgets()\y1)))If FormWindows()\FormGadgets()\pbanyline = ReplaceString(line,"%hwnd%",FormWindows()\FormGadgets()\variable)Elseline = ReplaceString(line,"%hwnd%","#"+FormWindows()\FormGadgets()\variable)EndIfIf FormWindows()\FormGadgets()\captionvariableline = ReplaceString(line,"%txt%",FormWindows()\FormGadgets()\caption)Elseline = ReplaceString(line,"%txt%",Chr(34)+FormWindows()\FormGadgets()\caption+Chr(34))EndIfcontent + " ; "+Str(ListIndex(FormWindows()\FormGadgets())) + " Custom gadget creation (do not remove this line) " + FormWindows()\FormGadgets()\cust_create + #Endline + line + #EndlineElseIf ObjList()\gadget_item > -1Debug ObjList()\nameline.s = " AddGadgetItem("SelectElement(FormWindows()\FormGadgets()\Items(),ObjList()\gadget_item)If FormWindows()\FormGadgets()\pbanyline + FormWindows()\FormGadgets()\variableElseline + "#" + FormWindows()\FormGadgets()\variableEndIfIf FormWindows()\FormGadgets()\type <> #Form_Type_Panelitemstring.s = ReplaceString(ObjList()\name,"|",Chr(34) + " + Chr(10) + " + Chr(34))Elseitemstring.s = ObjList()\nameEndIfline + ", -1, "+Chr(34)+itemstring+Chr(34)If FormWindows()\FormGadgets()\Items()\level > 0line + ", 0, " + Str(FormWindows()\FormGadgets()\Items()\level)EndIfline + ")"content + line + #EndlineElseIf FormWindows()\FormGadgets()\type = #Form_Type_Container Or FormWindows()\FormGadgets()\type = #Form_Type_Panel Or FormWindows()\FormGadgets()\type = #Form_Type_ScrollAreaAddElement(ContainerLevel())ContainerLevel() = ObjList()\levelElseIf FormWindows()\FormGadgets()\type = #Form_Type_Frame3DIf FormWindows()\FormGadgets()\flags & #PB_Frame_ContainerAddElement(ContainerLevel())ContainerLevel() = ObjList()\levelEndIfEndIfIf FormWindows()\FormGadgets()\pbanyline.s = FormWindows()\FormGadgets()\variable + " = "Elseline.s = ""EndIfSelect FormWindows()\FormGadgets()\type ;{ procedure nameCase #Form_Type_Buttonline + "ButtonGadget("Case #Form_Type_ButtonImgline + "ButtonImageGadget("Case #Form_Type_StringGadgetline + "StringGadget("Case #Form_Type_Checkboxline + "CheckBoxGadget("Case #Form_Type_Textline + "TextGadget("Case #Form_Type_Optionline + "OptionGadget("Case #Form_Type_TreeGadgetline + "TreeGadget("Case #Form_Type_ListViewline + "ListViewGadget("Case #Form_Type_ListIconline + "ListIconGadget("Case #Form_Type_Comboline + "ComboBoxGadget("Case #Form_Type_Spinline + "SpinGadget("Case #Form_Type_Trackbarline + "TrackBarGadget("Case #Form_Type_ProgressBarline + "ProgressBarGadget("Case #Form_Type_Imgline + "ImageGadget("Case #Form_Type_IPline + "IPAddressGadget("Case #Form_Type_Scrollbarline + "ScrollBarGadget("Case #Form_Type_HyperLinkline + "HyperLinkGadget("Case #Form_Type_Editorline + "EditorGadget("Case #Form_Type_ExplorerTreeline + "ExplorerTreeGadget("Case #Form_Type_ExplorerListline + "ExplorerListGadget("Case #Form_Type_ExplorerComboline + "ExplorerComboGadget("Case #Form_Type_Dateline + "DateGadget("Case #Form_Type_Calendarline + "CalendarGadget("Case #Form_Type_Scintillaline + "ScintillaGadget("Case #Form_Type_Splitterline + "SplitterGadget("Case #Form_Type_Frame3Dline + "FrameGadget("Case #Form_Type_ScrollArealine + "ScrollAreaGadget("Case #Form_Type_Webline + "WebGadget("Case #Form_Type_WebViewline + "WebViewGadget("Case #Form_Type_Containerline + "ContainerGadget("Case #Form_Type_Panelline + "PanelGadget("Case #Form_Type_Canvasline + "CanvasGadget("Case #Form_Type_OpenGLline + "OpenGLGadget(";}EndSelectIf FormWindows()\FormGadgets()\pbanyvariable.s = "#PB_Any"Elsevariable.s = "#" + FormWindows()\FormGadgets()\variableEndIfline.s + variable + ", "linevars.s = ""If FormWindows()\pbanywinvar.s = FormWindows()\variableElsewinvar.s = "#" + FormWindows()\variableEndIf; xIf FormWindows()\FormGadgets()\lock_left ;{linevars + Str(DesktopUnscaledX(FormWindows()\FormGadgets()\x1))+", "ElseIf FormWindows()\FormGadgets()\parentPushListPosition(FormWindows()\FormGadgets())FD_FindParent(FormWindows()\FormGadgets()\parent)If FormWindows()\FormGadgets()\pbanygadgetvar.s = FormWindows()\FormGadgets()\variableElsegadgetvar.s = "#" + FormWindows()\FormGadgets()\variableEndIfIf FormWindows()\FormGadgets()\type = #Form_Type_Panellinevars + "GetGadgetAttribute("+gadgetvar+",#PB_Panel_ItemWidth) - "Elselinevars + "GadgetWidth("+gadgetvar+") - "EndIftempvalue = FormWindows()\FormGadgets()\x2 - FormWindows()\FormGadgets()\x1PopListPosition(FormWindows()\FormGadgets())linevars + Str(DesktopUnscaledX(tempvalue - FormWindows()\FormGadgets()\x1)) + ", "Elselinevars + "FormWindowWidth - " + Str(DesktopUnscaledX(FormWindows()\width - FormWindows()\FormGadgets()\x1))+", "EndIfEndIf ;}; yIf FormWindows()\FormGadgets()\lock_top ;{linevars + codepaddingy + Str(FormWindows()\FormGadgets()\y1)+", "ElseIf FormWindows()\FormGadgets()\parentPushListPosition(FormWindows()\FormGadgets())FD_FindParent(FormWindows()\FormGadgets()\parent)If FormWindows()\FormGadgets()\pbanygadgetvar.s = FormWindows()\FormGadgets()\variableElsegadgetvar.s = "#" + FormWindows()\FormGadgets()\variableEndIfIf FormWindows()\FormGadgets()\type = #Form_Type_Panellinevars + codepaddingy + "GetGadgetAttribute("+gadgetvar+",#PB_Panel_ItemHeight) - "Elselinevars + codepaddingy + "GadgetHeight("+gadgetvar+") - "EndIftempvalue = FormWindows()\FormGadgets()\y2 - FormWindows()\FormGadgets()\y1If FormWindows()\FormGadgets()\type = #Form_Type_Paneltempvalue - Panel_HeightEndIfPopListPosition(FormWindows()\FormGadgets())linevars + Str(tempvalue - FormWindows()\FormGadgets()\y1) + ", "Elselinevars + codepaddingy + "FormWindowHeight - " + Str(FormWindows()\height - FormWindows()\FormGadgets()\y1)+", "EndIfEndIf ;}; widthIf FormWindows()\FormGadgets()\lock_right And FormWindows()\FormGadgets()\lock_left ;{If FormWindows()\FormGadgets()\parentPushListPosition(FormWindows()\FormGadgets())FD_FindParent(FormWindows()\FormGadgets()\parent)If FormWindows()\FormGadgets()\pbanygadgetvar.s = FormWindows()\FormGadgets()\variableElsegadgetvar.s = "#" + FormWindows()\FormGadgets()\variableEndIfIf FormWindows()\FormGadgets()\type = #Form_Type_Panellinevars + "GetGadgetAttribute("+gadgetvar+",#PB_Panel_ItemWidth) - "Elselinevars + "GadgetWidth("+gadgetvar+") - "EndIftempvalue = FormWindows()\FormGadgets()\x2 - FormWindows()\FormGadgets()\x1PopListPosition(FormWindows()\FormGadgets())linevars + Str(DesktopUnscaledX(tempvalue - (FormWindows()\FormGadgets()\x2 - FormWindows()\FormGadgets()\x1))) + ", "Elselinevars + "FormWindowWidth - " + Str(DesktopUnscaledX(FormWindows()\width - (FormWindows()\FormGadgets()\x2 - FormWindows()\FormGadgets()\x1)))+", "EndIfElselinevars + Str(DesktopUnscaledX(FormWindows()\FormGadgets()\x2 - FormWindows()\FormGadgets()\x1))+", "EndIf ;}; heightIf FormWindows()\FormGadgets()\lock_top And FormWindows()\FormGadgets()\lock_bottom ;{If FormWindows()\FormGadgets()\parentPushListPosition(FormWindows()\FormGadgets())FD_FindParent(FormWindows()\FormGadgets()\parent)If FormWindows()\FormGadgets()\pbanygadgetvar.s = FormWindows()\FormGadgets()\variableElsegadgetvar.s = "#" + FormWindows()\FormGadgets()\variableEndIfIf FormWindows()\FormGadgets()\type = #Form_Type_Panellinevars + "GetGadgetAttribute("+gadgetvar+",#PB_Panel_ItemHeight) - "Elselinevars + "GadgetHeight("+gadgetvar+") - "EndIftempvalue = FormWindows()\FormGadgets()\y2 - FormWindows()\FormGadgets()\y1If FormWindows()\FormGadgets()\type = #Form_Type_Paneltempvalue - Panel_HeightEndIfPopListPosition(FormWindows()\FormGadgets())linevars + Str(tempvalue - (FormWindows()\FormGadgets()\y2 - FormWindows()\FormGadgets()\y1))Elsevalue = FormWindows()\height - (FormWindows()\FormGadgets()\y2 - FormWindows()\FormGadgets()\y1)If FormSkin <> #PB_OS_MacOSvalue - bottompaddingsb - toptoolpaddingIf ListSize(FormWindows()\FormMenus())value - P_MenuEndIfElsevalue - bottompaddingsbEndIfIf codepaddingheight <> ""linevars + "FormWindowHeight" + codepaddingheight + " - " + Str(value)Elselinevars + "FormWindowHeight - " + Str(value)EndIfEndIfElselinevars + Str(FormWindows()\FormGadgets()\y2 - FormWindows()\FormGadgets()\y1)EndIf ;}line + Str(DesktopUnscaledX(FormWindows()\FormGadgets()\x1)) + ", " + codepaddingy + Str(DesktopUnscaledY(FormWindows()\FormGadgets()\y1)) + ", " + Str(DesktopUnscaledX(FormWindows()\FormGadgets()\x2 - FormWindows()\FormGadgets()\x1)) + ", " + Str(DesktopUnscaledY(FormWindows()\FormGadgets()\y2 - FormWindows()\FormGadgets()\y1))If (FormWindows()\FormGadgets()\lock_right And FormWindows()\FormGadgets()\lock_left) Or(FormWindows()\FormGadgets()\lock_top And FormWindows()\FormGadgets()\lock_bottom) Or(Not FormWindows()\FormGadgets()\lock_top And FormWindows()\FormGadgets()\lock_bottom) Or(FormWindows()\FormGadgets()\lock_right And Not FormWindows()\FormGadgets()\lock_left)If FormWindows()\FormGadgets()\pbanycontentsize.s + " ResizeGadget(" + FormWindows()\FormGadgets()\variable + ", " + linevars + ")" + #EndlineElsecontentsize.s + " ResizeGadget(#" + FormWindows()\FormGadgets()\variable + ", " + linevars + ")" + #EndlineEndIfEndIfflags.s = ""ForEach Gadgets()If Gadgets()\type = FormWindows()\FormGadgets()\typeForEach Gadgets()\Flags()If FormWindows()\FormGadgets()\flags & Gadgets()\Flags()\ivalueIf flags <> ""flags + " | "EndIfflags + Gadgets()\Flags()\nameEndIfNextEndIfNextIf flagsflags = ", "+flagsEndIf; add caption for the gadgets who requires it.Select FormWindows()\FormGadgets()\type ;{Case #Form_Type_Web, #Form_Type_Frame3D, #Form_Type_ExplorerCombo, #Form_Type_ExplorerList, #Form_Type_ExplorerTree, #Form_Type_HyperLink, #Form_Type_Button, #Form_Type_StringGadget, #Form_Type_Checkbox, #Form_Type_Text, #Form_Type_Option, #Form_Type_DateIf FormWindows()\FormGadgets()\captionvariableIf FormWindows()\FormGadgets()\caption = ""line + ", "+Chr(34)+Chr(34)Elseline + ", "+FormWindows()\FormGadgets()\captionEndIfElseline + ", "+Chr(34)+FormWindows()\FormGadgets()\caption+Chr(34)EndIfEndSelect ;}; additional parameters (min, max...)Select FormWindows()\FormGadgets()\type ;{Case #Form_Type_Date ;{If flags <> ""line + ", 0"EndIf;}Case #Form_Type_ButtonImg ;{img_id.s = ""If FormWindows()\FormGadgets()\imageChangeCurrentElement(FormWindows()\FormImg(),FormWindows()\FormGadgets()\image)ForEach Img()If Img()\img = FormWindows()\FormImg()\imgimg_id = Img()\idBreakEndIfNextEndIfIf img_id <> ""line + ", ImageID("+img_id+")"Elseline + ", 0"EndIf;}Case #Form_Type_ListIcon ;{If ListSize(FormWindows()\FormGadgets()\Columns())FirstElement(FormWindows()\FormGadgets()\Columns())line + ", " + Chr(34) + FormWindows()\FormGadgets()\Columns()\name + Chr(34) + ", " + Str(FormWindows()\FormGadgets()\Columns()\width)Elseline + ", " + Chr(34) + Chr(34) + ", 100"EndIf;}Case #Form_Type_Spin ;{line + ", "+ Str(FormWindows()\FormGadgets()\min) +", " + Str(FormWindows()\FormGadgets()\max);}Case #Form_Type_Trackbar ;{line + ", "+ Str(FormWindows()\FormGadgets()\min) +", " + Str(FormWindows()\FormGadgets()\max);}Case #Form_Type_ProgressBar ;{line + ", "+ Str(FormWindows()\FormGadgets()\min) +", " + Str(FormWindows()\FormGadgets()\max);}Case #Form_Type_Img ;{img_id.s = ""If FormWindows()\FormGadgets()\imageChangeCurrentElement(FormWindows()\FormImg(),FormWindows()\FormGadgets()\image)ForEach Img()If Img()\img = FormWindows()\FormImg()\imgimg_id = Img()\idBreakEndIfNextEndIfIf img_id <> ""line + ", ImageID("+img_id+")"Elseline + ", 0"EndIf;}Case #Form_Type_Scrollbar ;{line + ", "+ Str(FormWindows()\FormGadgets()\min) +", " + Str(FormWindows()\FormGadgets()\max) + ", 0";}Case #Form_Type_HyperLink ;{line + ", 0";}Case #Form_Type_Scintilla ;{If FormWindows()\FormGadgets()\caption <> "" And FormWindows()\FormGadgets()\caption <> "0"line + ", @"+FormWindows()\FormGadgets()\caption ; caption is in fact the callbackElseline + ", 0"EndIf;}Case #Form_Type_Splitter ;{gadget1 = FormWindows()\FormGadgets()\gadget1gadget2 = FormWindows()\FormGadgets()\gadget2PushListPosition(FormWindows()\FormGadgets())ForEach FormWindows()\FormGadgets()If FormWindows()\FormGadgets()\itemnumber = gadget1var1.s = FormWindows()\FormGadgets()\variableIf Not FormWindows()\FormGadgets()\pbanyvar1 = "#" + var1EndIfEndIfIf FormWindows()\FormGadgets()\itemnumber = gadget2var2.s = FormWindows()\FormGadgets()\variableIf Not FormWindows()\FormGadgets()\pbanyvar2 = "#" + var2EndIfEndIfNextPopListPosition(FormWindows()\FormGadgets())line + ", " + var1 + ", " + var2;}Case #Form_Type_ScrollArea ;{line + ", "+ Str(FormWindows()\FormGadgets()\min) +", " + Str(FormWindows()\FormGadgets()\max) + ", 1";}Case #Form_Type_Calendar ;{line + ", 0";}EndSelect ;}line + flags + ")"content + " "+line + #EndlineIf FormWindows()\FormGadgets()\pbanyvariable.s = FormWindows()\FormGadgets()\variableElsevariable.s = "#" + FormWindows()\FormGadgets()\variableEndIfIf FormWindows()\FormGadgets()\hiddencontent + " HideGadget("+variable+", 1)" + #EndlineEndIfIf FormWindows()\FormGadgets()\tooltip <> ""If FormWindows()\FormGadgets()\tooltipvariabletooltip.s = FormWindows()\FormGadgets()\tooltipElsetooltip.s = Chr(34) + FormWindows()\FormGadgets()\tooltip + Chr(34)EndIfcontent + " GadgetToolTip(" + variable + ", " + tooltip + ")" + #EndlineEndIfForEach FormWindows()\FormGadgets()\Columns()If ListIndex(FormWindows()\FormGadgets()\Columns()) = 0ContinueEndIfcontent + " AddGadgetColumn(" + variable + ", " + Str(ListIndex(FormWindows()\FormGadgets()\Columns())) + ", " + Chr(34) + FormWindows()\FormGadgets()\Columns()\name + Chr(34) + ", " + Str(FormWindows()\FormGadgets()\Columns()\width) + ")" + #EndlineNextIf FormWindows()\FormGadgets()\stateSelect FormWindows()\FormGadgets()\typeCase #Form_Type_Checkboxcontent + " SetGadgetState("+variable+", #PB_Checkbox_Checked)" + #EndlineCase #Form_Type_Optioncontent + " SetGadgetState("+variable+", 1)" + #EndlineCase #Form_Type_Splittercontent + " SetGadgetState("+variable+", "+Str(FormWindows()\FormGadgets()\state)+")" + #EndlineEndSelectEndIfIf FormWindows()\FormGadgets()\frontcolor > -1content + " SetGadgetColor("+variable+", #PB_Gadget_FrontColor,RGB("+Str(Red(FormWindows()\FormGadgets()\frontcolor))+","+Str(Green(FormWindows()\FormGadgets()\frontcolor))+","+Str(Blue(FormWindows()\FormGadgets()\frontcolor))+"))" + #EndlineEndIfIf FormWindows()\FormGadgets()\backcolor > -1content + " SetGadgetColor("+variable+", #PB_Gadget_BackColor,RGB("+Str(Red(FormWindows()\FormGadgets()\backcolor))+","+Str(Green(FormWindows()\FormGadgets()\backcolor))+","+Str(Blue(FormWindows()\FormGadgets()\backcolor))+"))" + #EndlineEndIfIf FormWindows()\FormGadgets()\gadgetfont <> ""ForEach Fonts()If Fonts()\flags = FormWindows()\FormGadgets()\gadgetfontflags And Fonts()\name = FormWindows()\FormGadgets()\gadgetfont And Fonts()\size = FormWindows()\FormGadgets()\gadgetfontsizeBreakEndIfNextcontent + " SetGadgetFont("+variable+", FontID("+Fonts()\id+"))" + #EndlineEndIfIf FormWindows()\FormGadgets()\disabledcontent + " DisableGadget("+variable+", 1)" + #EndlineEndIfEndIfEndIfElseIf Not firstwindowcontent +"EndProcedure" + #Endlinecontent +"" + #EndlineElsefirstwindow = 0EndIfIf FormWindows()\x = -65535winx.s = "#PB_Ignore"Elsewinx.s = Str(DesktopUnscaledX(FormWindows()\x))EndIfIf FormWindows()\y = -65535winy.s = "#PB_Ignore"Elsewiny.s = Str(DesktopUnscaledY(FormWindows()\y))EndIfcontent +"Procedure Open"+FormWindows()\variable+"(x = " + winx + ", y = " + winy + ", width = " + Str(DesktopUnscaledX(FormWindows()\width)) + ", height = " + Str(DesktopUnscaledY(FormWindows()\height)) + ")" + #EndlineAddElement(Procs())Procs() = "Open"+FormWindows()\variable+"()"flags.s = ""ForEach Gadgets()If Gadgets()\type = #Form_Type_WindowForEach Gadgets()\Flags()If FormWindows()\flags & Gadgets()\Flags()\ivalueIf flags <> ""flags + " | "EndIfflags + Gadgets()\Flags()\nameEndIfNextForEach FormWindows()\FormCustomFlags()If flags <> ""flags + " | "EndIfflags + FormWindows()\FormCustomFlags()NextEndIfNextIf flagsflags = ", "+flagsEndIfIf FormWindows()\pbanyvariable.s = FormWindows()\variableline.s = " "+FormWindows()\variable+" = OpenWindow(#PB_Any, x, y, width, height, "If FormWindows()\captionvariableIf FormWindows()\caption = ""line + Chr(34)+Chr(34)Elseline + FormWindows()\captionEndIfElseline + Chr(34)+FormWindows()\caption+Chr(34)EndIfElsevariable.s = "#"+FormWindows()\variableline.s = " OpenWindow("+variable+", x, y, width, height, "If FormWindows()\captionvariableline + FormWindows()\captionElseline + Chr(34)+FormWindows()\caption+Chr(34)EndIfEndIfline + flags; Add parentIf FormWindows()\parentIf flags = ""line + ", 0, "Elseline + ", "EndIfIf Asc(FormWindows()\parent) <> '='line + "WindowID(" + FormWindows()\parent + ")"Elseline + LTrim(FormWindows()\parent, "=")EndIfEndIfline + ")"content + line + #EndlineIf FormWindows()\hiddencontent + " HideWindow("+variable+", 1)" + #EndlineEndIfIf FormWindows()\disabledcontent + " DisableWindow("+variable+", 1)" + #EndlineEndIfIf FormWindows()\color > -1content + " SetWindowColor("+variable+", RGB("+Str(Red(FormWindows()\color))+","+Str(Green(FormWindows()\color))+","+Str(Blue(FormWindows()\color))+"))" + #EndlineEndIfaddemptyline = 0ForEach FormWindows()\FormMenus()If FormWindows()\FormMenus()\shortcut <> ""addemptyline = 1If FindString(FormWindows()\FormMenus()\shortcut,"+")mod.s = Trim(StringField(FormWindows()\FormMenus()\shortcut,1,"+"))Select LCase(mod) ; Use LCase() so it works with CTRL, Ctrl, etc. https://www.purebasic.fr/english/viewtopic.php?f=4&t=71127Case "cmd"mod = "Command"Case "ctrl"mod = "Control"Case "strg"mod = "Control"EndSelectshortcut.s = Trim(StringField(FormWindows()\FormMenus()\shortcut,2,"+"))content + " AddKeyboardShortcut("+ winid + ", #PB_Shortcut_" + mod + " | #PB_Shortcut_" + shortcut + ", " + FormWindows()\FormMenus()\id + ")" + #EndlineElsecontent + " AddKeyboardShortcut("+ winid + ", #PB_Shortcut_" + FormWindows()\FormMenus()\shortcut + ", " + FormWindows()\FormMenus()\id + ")" + #EndlineEndIfEndIfNextIf addemptylinecontent + #EndlineEndIfIf ListSize(FormWindows()\FormToolbars())content + " CreateToolbar("+Str(toolbarcount)+", WindowID("+variable+"))" + #Endlinetoolbarcount + 1ForEach FormWindows()\FormToolbars()If FormWindows()\FormToolbars()\separatorcontent + " ToolBarSeparator()" + #EndlineElseimg_id.s = ""If FormWindows()\FormToolbars()\imgChangeCurrentElement(FormWindows()\FormImg(),FormWindows()\FormToolbars()\img)ForEach Img()If Img()\img = FormWindows()\FormImg()\imgimg_id = Img()\idBreakEndIfNextEndIfline.s = " ToolBarImageButton("+FormWindows()\FormToolbars()\id+",ImageID("+img_id+")"If FormWindows()\FormToolbars()\toggleline + ", #PB_ToolBar_Toggle"EndIfline + ")"content + line + #EndlineIf FormWindows()\FormToolbars()\tooltip <> ""content + " ToolBarToolTip("+Str(toolbarcount - 1)+", "+FormWindows()\FormToolbars()\id+", "+Chr(34)+FormWindows()\FormToolbars()\tooltip+Chr(34) + ")" + #EndlineEndIfEndIfNextEndIfIf ListSize(FormWindows()\FormStatusbars())content + " CreateStatusBar("+Str(statusbarcount)+", WindowID("+variable+"))" + #EndlineForEach FormWindows()\FormStatusbars()If FormWindows()\FormStatusbars()\width = -1content + " AddStatusBarField(#PB_Ignore)" + #EndlineElsecontent + " AddStatusBarField("+Str(FormWindows()\FormStatusbars()\width)+")" + #EndlineEndIfflags.s = ""If FormWindows()\FormStatusbars()\flags & FlagValue("#PB_StatusBar_BorderLess")flags.s + "#PB_StatusBar_BorderLess"EndIfIf FormWindows()\FormStatusbars()\flags & FlagValue("#PB_StatusBar_Center")If flags <> ""flags + " | "EndIfflags.s + "#PB_StatusBar_Center"EndIfIf FormWindows()\FormStatusbars()\flags & FlagValue("#PB_StatusBar_Raised")If flags <> ""flags + " | "EndIfflags.s + "#PB_StatusBar_Raised"EndIfIf FormWindows()\FormStatusbars()\flags & FlagValue("#PB_StatusBar_Right")If flags <> ""flags + " | "EndIfflags.s + "#PB_StatusBar_Right"EndIfIf flags <> ""flags = ", " + flagsEndIfIf FormWindows()\FormStatusbars()\text <> ""content + " StatusBarText("+Str(statusbarcount)+", "+Str(ListIndex(FormWindows()\FormStatusbars()))+", "+Chr(34)+FormWindows()\FormStatusbars()\text+Chr(34)+flags+")" + #EndlineElseIf FormWindows()\FormStatusbars()\imgChangeCurrentElement(FormWindows()\FormImg(),FormWindows()\FormStatusbars()\img)ForEach Img()If Img()\img = FormWindows()\FormImg()\imgimg_id = Img()\idBreakEndIfNextcontent + " StatusBarImage("+Str(statusbarcount)+", "+Str(ListIndex(FormWindows()\FormStatusbars()))+", ImageID("+img_id+")"+flags+")" + #EndlineElseIf FormWindows()\FormStatusbars()\progressbar > 0content + " StatusBarProgress("+Str(statusbarcount)+", "+Str(ListIndex(FormWindows()\FormStatusbars()))+", 0"+flags+")" + #EndlineEndIfNextstatusbarcount + 1EndIfIf ListSize(FormWindows()\FormMenus())found = 0ForEach FormWindows()\FormMenus()If FormWindows()\FormMenus()\iconfound = 1BreakEndIfNextIf foundcontent + " CreateImageMenu("+Str(menucount)+", WindowID("+variable+"))" + #EndlineElsecontent + " CreateMenu("+Str(menucount)+", WindowID("+variable+"))" + #EndlineEndIfmenucount + 1level = 1ForEach FormWindows()\FormMenus()If FormWindows()\FormMenus()\separatorcontent + " MenuBar()" + #EndlineElseSelect FormWindows()\FormMenus()\levelCase 0For finishlevel = level To 2 Step -1content + " CloseSubMenu()" + #EndlineNextcontent + " MenuTitle("+Chr(34)+FormWindows()\FormMenus()\item+Chr(34)+")" + #Endlinelevel = FormWindows()\FormMenus()\levelDefaultthislevel = FormWindows()\FormMenus()\levelPushListPosition(FormWindows()\FormMenus())next_item = 0If NextElement(FormWindows()\FormMenus())If FormWindows()\FormMenus()\level > thislevel And FormWindows()\FormMenus()\level<>5next_item = 1EndIfEndIfPopListPosition(FormWindows()\FormMenus())If next_itemcontent + " OpenSubMenu("+Chr(34)+FormWindows()\FormMenus()\item+Chr(34)+")" + #EndlineElseIf FormWindows()\FormMenus()\level < levelcontent + " CloseSubMenu()" + #Endlinecontent + " MenuItem("+FormWindows()\FormMenus()\id+", "+Chr(34)+FormWindows()\FormMenus()\item+Chr(34)Elsecontent + " MenuItem("+FormWindows()\FormMenus()\id+", "+Chr(34)+FormWindows()\FormMenus()\item+Chr(34)EndIfIf FormWindows()\FormMenus()\shortcut <> ""content + " + Chr(9) + " + Chr(34) + FormWindows()\FormMenus()\shortcut + Chr(34)EndIfimg_id.s = ""If FormWindows()\FormMenus()\iconChangeCurrentElement(FormWindows()\FormImg(),FormWindows()\FormMenus()\icon)ForEach Img()If Img()\img = FormWindows()\FormImg()\imgimg_id = Img()\idBreakEndIfNextEndIfIf img_id <> ""content + ", ImageID("+img_id+")"EndIfcontent + ")" + #EndlineEndIflevel = FormWindows()\FormMenus()\levelEndSelectEndIfNextFor finishlevel = level To 2 Step -1content + " CloseSubMenu()" + #EndlineNextEndIfEndIfEndIfNextForEach ContainerLevel()content + " CloseGadgetList()" + #EndlineDeleteElement(ContainerLevel())Nextcontent +"EndProcedure" + #Endline + #EndlineIf codegenresizecontent + "Procedure ResizeGadgets" + FormWindows()\variable + "()" + #Endlinecontent + " Protected FormWindowWidth, FormWindowHeight" + #EndlineIf FormWindows()\pbanyvariable.s = FormWindows()\variableElsevariable.s = "#"+FormWindows()\variableEndIfcontent + " FormWindowWidth = WindowWidth(" + variable + ")" + #Endlinecontent + " FormWindowHeight = WindowHeight(" + variable + ")" + #Endlinecontent + contentsize + "EndProcedure" + #Endline + #EndlineEndIf; Events procedureIf (FormWindows()\generateeventloop And FormEventProcedure) Or testcodecontent + "Procedure " + FormWindows()\variable + "_Events(event)" + #Endlinecontent + " Select event" + #EndlineIf codegenresizecontent + " Case #PB_Event_SizeWindow" + #Endlinecontent + " ResizeGadgets" + FormWindows()\variable + "()" + #EndlineEndIfcontent + " Case #PB_Event_CloseWindow" + #Endlinecontent + " ProcedureReturn #False" + #Endline + #Endlinecontent + " Case #PB_Event_Menu" + #Endlinecontent + " Select EventMenu()" + #EndlineForEach MenuVars()content + " Case " + MenuVars()\a + #EndlineIf MenuVars()\b <> ""content + " " + MenuVars()\b + "(EventMenu())" + #EndlineEndIfNextcontent + " EndSelect" + #Endline + #Endlinecontent + " Case #PB_Event_Gadget" + #Endlinecontent + " Select EventGadget()" + #EndlineForEach FormWindows()\FormGadgets()If FormWindows()\FormGadgets()\event_procIf FormWindows()\FormGadgets()\pbanyvar.s = FormWindows()\FormGadgets()\variableElsevar.s = "#"+FormWindows()\FormGadgets()\variableEndIfcontent + " Case " + var + #Endlinecontent + " " + FormWindows()\FormGadgets()\event_proc + "(EventType())"content + " " + #EndlineEndIfNextcontent +" EndSelect" + #EndlineIf FormWindows()\event_procIf FormWindows()\pbanyvar.s = FormWindows()\variableElsevar.s = "#"+FormWindows()\variableEndIfcontent +" Default" + #Endlinecontent +" " + FormWindows()\event_proc + "(event,"+var+")" + #EndlineEndIfcontent +" EndSelect" + #Endlinecontent +" ProcedureReturn #True" + #Endlinecontent + "EndProcedure" + #Endlinecontent + "" + #EndlineEndIfIf testcode; Declare all event procedures;; MenusForEach MenuVars()If MenuVars()\b <> ""content + "Procedure " + MenuVars()\b + "(Event) : EndProcedure" + #EndlineEndIfNext; GadgetsForEach FormWindows()\FormGadgets()If FormWindows()\FormGadgets()\event_proccontent + "Procedure " + FormWindows()\FormGadgets()\event_proc + "(EventType) : EndProcedure" + #EndlineEndIfNext; WindowIf FormWindows()\event_proccontent +"Procedure " + FormWindows()\event_proc + "(Event, Window) : EndProcedure" + #EndlineEndIfEndIfIf testcodecontent + "Open"+FormWindows()\variable+"()" + #Endline + #Endlinecontent + "Repeat" + #Endline + " event = WaitWindowEvent()" + #Endlinecontent + "Until " + FormWindows()\variable + "_Events(event) = #False" + #Endline + #Endline + "End"EndIfinline = 0ForEach Img()If Img()\inlinecontent + #Endline + #Endline + "DataSection" + #Endlineinline = 1BreakEndIfNextForEach Img()If Img()\inlineimage_id.s = Img()\idIf Left(image_id, 1) = "#"image_id = Right(image_id, Len(image_id) - 1)EndIfcontent +" " + image_id + ": : IncludeBinary "+Chr(34)+Img()\img+Chr(34) + #EndlineEndIfNextIf inlinecontent +"EndDataSection" + #EndlineEndIfIf Not contentonlynum = CountString(content,#Endline)For i = 1 To num;TE_AddGadgetItem(code_gadget,-1,StringField(content,i,#Endline))Next; TE_RemoveGadgetItem(code_gadget,0); num = TE_CountGadgetItems(code_gadget) - 1EndIfIf contentonlyProcedureReturn contentElseProcedureReturn ""EndIfEndProcedure
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。