| AylinCE Grandmaster Cheater Supreme
 
  Reputation: 37 
 Joined: 16 Feb 2017
 Posts: 1527
 
 
 | 
			
				|  Posted: Fri Apr 04, 2025 9:18 pm    Post subject: CE Lua Script Menu: Forms and Controls |   |  
				| 
 |  
				|   
 Note: Some of the codes were created by compiling shares in the CE Forum archive.
 
 I added a useful menu for Lua Script.
 Menu items:
 
 Create Timer
ScrollBox Class
 Checkbox Colors
 Effect Checkbox Colors
 Button Panels
 Color  Palette
 Form to Lua
 
 Menu expansions for the archive:
 
 Type the name you will give to the timer in the input window that will open and you will see that the following output is added to the script with the name you gave.
 
  	  | Code: |  	  | ---------------------------- if tmr1 then tmr1.Destroy() tmr1=nil end
 
 tmr1=createTimer()
 tmr1.Interval=1000
 tmr1.Enabled=false -- true
 
 tmr1.OnTimer=function()
 
 end
 ----------------------------
 | 
 
 
 
  	  | Code: |  	  | ----------------------- ComponentClass ScrollBox ----- function createTScrollBox(Parent)
 local cnt = createComponentClass('TScrollBox', Parent)
 cnt.Parent = Parent
 return cnt
 end
 -------------------------
 | 
 
 
 
 
  	  | Code: |  	  | ----------------------- CheckBox Colors ----- function setCheckBoxColors(chk)
 return executeCodeLocalEx('uxtheme.SetWindowTheme', chk.handle, '', '')
 end
 -------------------------
 | 
 --Use:
 
  	  | Code: |  	  | setCheckBoxColors(UDF1.CECheckbox1) UDF1.CECheckbox1.Color = clWhite
 UDF1.CECheckbox1.Font.Color = 0x0000ff
 | 
 
 
 
 Optionally adds some features to the Checkbox.
 
 Coloring.
When activated, "ON!"
 When deactivated, "OFF!"
 When activated, the color changes.
 When deactivated, it returns to the original color.
 
 
  	  | Code: |  	  | ----------------------- CheckBox Colors Effect----- function chkcolors(chk1,clron,clroff,cpt,cptopt)
 executeCodeLocalEx('uxtheme.SetWindowTheme', chk1.handle, "", "")
 chk1.AutoSize = true
 chk1.Font.Color = clroff chk1.Cursor = -21
 
 chk1.OnClick=function(sender)
 if cptopt==1 then
 if sender.State==1 then
 sender.Caption = cpt .. " (ON!)"
 else
 sender.Caption = cpt .. " (OFF!)"
 end
 else
 if sender.State==1 then
 sender.Caption = cpt .. " "
 else
 sender.Caption = cpt
 end
 end
 end
 
 chk1.OnChangeBounds=function(sender)
 if sender.state==1 then
 sender.Font.Color = clron
 else
 sender.Font.Color = clroff
 end
 end
 if cptopt==1 then chk1.Caption=cpt.." (OFF!)" else chk1.Caption=cpt end
 end
 --------------------------
 | 
 --Use: Name, Color, Font Color, Caption, Change Caption: 1=ON!-OFF!, 0 no change..
 
  	  | Code: |  	  | chkcolors(UDF1.CECheckbox1,clBlack,clRed,'Hack 1',1) chkcolors(UDF1.CECheckbox2,clBlack,0x0000FF,'Hack 2',0)
 | 
 
 
 
 Allows you to use a panel with partial button behaviors.
 
 Color change when mouse cursor is on or off.
Color change when clicked.
 
 
  	  | Code: |  	  | ---------------------- Panel Button Effect -------- function createBtnpanel(owner,clr)
 obj1=createPanel(owner)
 obj1.Color=clr obj1.Cursor = -21
 obj1.OnMouseMove = function()
 obj1.Color = tonumber(clr) - 4000
 end
 obj1.OnMouseLeave = function()
 obj1.Color = clr
 end
 obj1.OnMouseDown = function()
 obj1.Color = tonumber(clr) - 8000
 end
 obj1.OnMouseUp = function()
 obj1.Color = clr
 end
 return obj1
 end
 ----------------------
 | 
 -- use: ----------->  Owner,   panel color
 
  	  | Code: |  	  | pnl1 = createBtnpanel(UDF1, 9180234) pnl2 = createBtnpanel(UDF1, 0xffff00)
 | 
 
 
 
 
   
 Creates a color palette.
 
 
 The color you click on from palette 1 will be reflected in palette 2 and will print the color codes in the boxes. 
 
 Each click on panel 2 will allow you to select "Palet Color" or "Palet Font Color" for the color. 
 
 Clicking on the color code boxes will automatically copy the code. 
 
 
 It codes a form and its controls that you created in the form designer as a form created in lua script.
 Some of its features:
 
 If your form has a Checkbox, it comes with a color code.
If your form has a Scrollbox, it comes with a "creation class".
 Many properties are not added to the script to save space. (You will see this after the first use.)
 It comes with a transparent property for the form. (It is disabled and used optionally.)
 The screen DPI attributes come with all dimensions assigned.
 
 Here is the output of a "Form to Lua" using some of the properties:
 
 
  	  | Code: |  	  | if UDF1 then UDF1.Destroy() UDF1=nil end DP1=getScreenDPI()/96
 UDF1=createForm()
 UDF1.height=300*DP1 UDF1.width=280*DP1 UDF1.left=459*DP1 UDF1.top=286*DP1
 UDF1.PopupMode=0 UDF1.caption="UDF1"
 UDF1.Position="poDesktopCenter" UDF1.ShowInTaskBar="stAlways"
 UDF1.BorderStyle="bsSingle"
 --[==[
 UDF1.BorderStyle="bsNone"
 UDF1.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )
 UDF1.Color=0x000100
 Object.OnMouseDown=function() UDF1.DragNow() end
 --]==]
 -------------------------
 local ftbl = {}
 ----------------------- ComponentClass ScrollBox -----
 function createTScrollBox(Parent)
 local cnt = createComponentClass('TScrollBox', Parent)
 cnt.Parent = Parent
 return cnt
 end
 -------------------------
 ----------------------- ftbl.ScrollBox1 -----
 ftbl.ScrollBox1=createTScrollBox(UDF1)
 ftbl.ScrollBox1.AutoSize=false
 ftbl.ScrollBox1.height=150*DP1 ftbl.ScrollBox1.width=150*DP1 ftbl.ScrollBox1.left=66*DP1 ftbl.ScrollBox1.top=9*DP1
 ftbl.ScrollBox1.Font.Style="fsBold" ftbl.ScrollBox1.Font.Size=0*DP1
 ftbl.ScrollBox1.AutoScroll=true
 -----------------------
 ----------------------- CheckBox Colors -----
 function setCheckBoxColors(chk,clr,fclr)
 executeCodeLocalEx('uxtheme.SetWindowTheme', chk.handle, "", "")
 chk.Color = clr
 chk.Font.Color = fclr
 end
 -------------------------
 
 ---------------------- Panel Button Effect --------
 function createBtnpanel(owner,clr)
 local obj1=createPanel(owner)
 obj1.Color=clr obj1.Cursor = -21
 obj1.OnMouseMove = function()
 obj1.Color = tonumber(clr) - 4000
 end
 obj1.OnMouseLeave = function()
 obj1.Color = clr
 end
 obj1.OnMouseDown = function()
 obj1.Color = tonumber(clr) - 8000
 end
 obj1.OnMouseUp = function()
 obj1.Color = clr
 end
 return obj1
 end
 ----------------------
 ----------------------- ftbl.CECheckbox1 -----
 ftbl.CECheckbox1=createCheckBox(ftbl.ScrollBox1)
 ftbl.CECheckbox1.AutoSize=true
 ftbl.CECheckbox1.height=19*DP1 ftbl.CECheckbox1.width=93*DP1 ftbl.CECheckbox1.left=13*DP1 ftbl.CECheckbox1.top=15*DP1
 ftbl.CECheckbox1.caption="CECheckbox1"
 ftbl.CECheckbox1.alignment="taRightJustify"
 ftbl.CECheckbox1.Font.Style="fsBold" ftbl.CECheckbox1.Font.Size=0*DP1
 setCheckBoxColors(ftbl.CECheckbox1,536870912,536870912)
 -----------------------
 ----------------------- ftbl.CECheckbox2 -----
 ftbl.CECheckbox2=createCheckBox(ftbl.ScrollBox1)
 ftbl.CECheckbox2.AutoSize=true
 ftbl.CECheckbox2.height=19*DP1 ftbl.CECheckbox2.width=93*DP1 ftbl.CECheckbox2.left=28*DP1 ftbl.CECheckbox2.top=42*DP1
 ftbl.CECheckbox2.caption="CECheckbox2"
 ftbl.CECheckbox2.alignment="taRightJustify"
 ftbl.CECheckbox2.Font.Style="fsBold" ftbl.CECheckbox2.Font.Size=0*DP1
 setCheckBoxColors(ftbl.CECheckbox2,536870912,536870912)
 -----------------------
 ----------------------- ftbl.CECheckbox3 -----
 ftbl.CECheckbox3=createCheckBox(ftbl.ScrollBox1)
 ftbl.CECheckbox3.AutoSize=true
 ftbl.CECheckbox3.height=19*DP1 ftbl.CECheckbox3.width=93*DP1 ftbl.CECheckbox3.left=47*DP1 ftbl.CECheckbox3.top=69*DP1
 ftbl.CECheckbox3.caption="CECheckbox3"
 ftbl.CECheckbox3.alignment="taRightJustify"
 ftbl.CECheckbox3.Font.Style="fsBold" ftbl.CECheckbox3.Font.Size=0*DP1
 setCheckBoxColors(ftbl.CECheckbox3,536870912,536870912)
 -----------------------
 ----------------------- ftbl.CECheckbox4 -----
 ftbl.CECheckbox4=createCheckBox(ftbl.ScrollBox1)
 ftbl.CECheckbox4.AutoSize=true
 ftbl.CECheckbox4.height=19*DP1 ftbl.CECheckbox4.width=93*DP1 ftbl.CECheckbox4.left=67*DP1 ftbl.CECheckbox4.top=97*DP1
 ftbl.CECheckbox4.caption="CECheckbox4"
 ftbl.CECheckbox4.alignment="taRightJustify"
 ftbl.CECheckbox4.Font.Style="fsBold" ftbl.CECheckbox4.Font.Size=0*DP1
 setCheckBoxColors(ftbl.CECheckbox4,536870912,536870912)
 -----------------------
 ----------------------- ftbl.CECheckbox5 -----
 ftbl.CECheckbox5=createCheckBox(ftbl.ScrollBox1)
 ftbl.CECheckbox5.AutoSize=true
 ftbl.CECheckbox5.height=19*DP1 ftbl.CECheckbox5.width=93*DP1 ftbl.CECheckbox5.left=92*DP1 ftbl.CECheckbox5.top=125*DP1
 ftbl.CECheckbox5.caption="CECheckbox5"
 ftbl.CECheckbox5.alignment="taRightJustify"
 ftbl.CECheckbox5.Font.Style="fsBold" ftbl.CECheckbox5.Font.Size=0*DP1
 setCheckBoxColors(ftbl.CECheckbox5,536870912,536870912)
 -----------------------
 ----------------------- ftbl.CECheckbox6 -----
 ftbl.CECheckbox6=createCheckBox(UDF1)
 ftbl.CECheckbox6.AutoSize=true
 ftbl.CECheckbox6.height=19*DP1 ftbl.CECheckbox6.width=93*DP1 ftbl.CECheckbox6.left=108*DP1 ftbl.CECheckbox6.top=170*DP1
 ftbl.CECheckbox6.caption="CECheckbox6"
 ftbl.CECheckbox6.alignment="taRightJustify"
 ftbl.CECheckbox6.Font.Style="fsBold" ftbl.CECheckbox6.Font.Size=0*DP1
 setCheckBoxColors(ftbl.CECheckbox6,536870912,536870912)
 -----------------------
 ----------------------- ftbl.CEPanel1 -----
 ftbl.CEPanel1=createBtnpanel(UDF1,0xFFFF32)
 ftbl.CEPanel1.AutoSize=false
 ftbl.CEPanel1.height=26*DP1 ftbl.CEPanel1.width=170*DP1 ftbl.CEPanel1.left=36*DP1 ftbl.CEPanel1.top=199*DP1
 ftbl.CEPanel1.caption="CEPanel1"
 ftbl.CEPanel1.alignment="2"
 ftbl.CEPanel1.Font.Style="fsBold" ftbl.CEPanel1.Font.Size=0*DP1
 -----------------------
 ----------------------- ftbl.CEPanel2 -----
 ftbl.CEPanel2=createBtnpanel(UDF1,0xFFFF32)
 ftbl.CEPanel2.AutoSize=false
 ftbl.CEPanel2.height=26*DP1 ftbl.CEPanel2.width=170*DP1 ftbl.CEPanel2.left=64*DP1 ftbl.CEPanel2.top=243*DP1
 ftbl.CEPanel2.caption="CEPanel2"
 ftbl.CEPanel2.alignment="2"
 ftbl.CEPanel2.Font.Style="fsBold" ftbl.CEPanel2.Font.Size=0*DP1
 -----------------------
 
 --############################################################################--
 --############################################################################--
 
 ----------------------- CheckBox Colors Effect-----
 function chkcolors(chk1,clron,clroff,cpt,cptopt)
 executeCodeLocalEx('uxtheme.SetWindowTheme', chk1.handle, "", "")
 chk1.AutoSize = true
 chk1.Font.Color = clroff chk1.Cursor = -21
 
 chk1.OnClick=function(sender)
 if cptopt==1 then
 if sender.State==1 then
 sender.Caption = cpt .. " (ON!)"
 else
 sender.Caption = cpt .. " (OFF!)"
 end
 else
 if sender.State==1 then
 sender.Caption = cpt .. " "
 else
 sender.Caption = cpt
 end
 end
 end
 
 chk1.OnChangeBounds=function(sender)
 if sender.state==1 then
 sender.Font.Color = clron
 else
 sender.Font.Color = clroff
 end
 end
 if cptopt==1 then chk1.Caption=cpt.." (OFF!)" else chk1.Caption=cpt end
 end
 -------------------------------------------------
 
 for l,k in pairs(ftbl) do
 if l:find("CECheckbox") then
 chkcolors(ftbl[l],0xFF0000,0x9932FF,ftbl[l].Caption,1)
 end
 end
 
 -- caption test
 chkcolors(ftbl.CECheckbox6,0xFF0000,0x9932FF,"CECheckbox6",0)
 
 
 ftbl.CECheckbox1.OnChange=function(sender)
 printf("%s, checked: %s",sender.caption,sender.checked)
 end
 
 ftbl.CECheckbox2.OnChange=function(sender)
 printf("%s, checked: %s",sender.caption,sender.checked)
 end
 
 ftbl.CECheckbox3.OnChange=function(sender)
 printf("%s, checked: %s",sender.caption,sender.checked)
 end
 
 ftbl.CECheckbox6.OnChange=function(sender)
 printf("%s, checked: %s",sender.caption,sender.checked)
 end
 
 | 
 
 The plugin code file is given below.
 
 We have come to the end of another article.
 If the code ideas helped you, you can click on the thumb icon under my profile picture and leave a (free) reputation.
 
 Until we meet again, enjoy it.
 
 
 
 
	
		
	 
		| Description: | 
			
				| Download the file and drop it in the CE >> autorun folder. Start using it in the Lua script menu...
 |  |  Download
 |  
		| Filename: | frmtolua1.lua |  
		| Filesize: | 24.2 KB |  
		| Downloaded: | 15034 Time(s) |  
 _________________
 
 |  |