 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Tue Jan 14, 2020 12:17 am Post subject: The edit box has two properties that do not work |
|
|
| Code: | TextHintFontColor;
TextHintFontStyle; | These two attributes don't seem to work
| Code: | if f then f.destroy() end
f = createForm(true)
f.width = 320
f.height = 120
f.position = poScreenCenter
edit = createEdit(f)
edit.width = 290
edit.height = 23
edit.TextHint='Test 1'
edit.TextHintFontColor=0xff
edit.TextHintFontStyle=1
control_setPosition(edit, 15,20)
edit2 = createEdit(f)
edit2.width = 290
edit2.height = 23
edit2.TextHint='Test 2'
edit2.TextHintFontColor=0xFF8205
edit2.TextHintFontStyle=2
control_setPosition(edit2, 15,70) |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25832 Location: The netherlands
|
Posted: Tue Jan 14, 2020 6:52 am Post subject: |
|
|
correct, they are only for backwards compatibility
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Tue Jan 14, 2020 7:14 am Post subject: |
|
|
| Dark Byte wrote: | | correct, they are only for backwards compatibility | Can they work in ce7.1?
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Thu Jan 16, 2020 10:26 pm Post subject: |
|
|
Alternatively, using a trick in a primitive way, for example:
| Code: | local frame
function showTooltips(sender)
frame = createPanel(f)
frame.setSize(100,100)
frame.Left = sender.Left + sender.Width - 20
frame.Top = sender.Top + sender.Height + 5
frame.Color = '0xffffff'
lbl = createLabel(frame)
lbl.Caption = 'Test'
frame.Visible = true
end
function hideTooltips(sender)
frame.Visible = false
--frame.Destroy()
end
f = createForm()
f.Caption = 'Test Tooltips on Editbox'
e = createEdit(f)
e.setPosition(40,20)
e.onMouseEnter = showTooltips
e.onMouseLeave = hideTooltips
|
Just need to modify the function so it accessing for global components and destroy tooltips components under mouse leave event.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Sat Oct 24, 2020 3:00 am Post subject: how about a button...? |
|
|
@Corroder: the script works fine for an Editbox, but does not seem to work for a button...?
Well, just to be clear: I ran the script in its own frame first, which works as expected. I am now trying to run this within a ce form panel... first tried with button, and since I got nothing, tried with Editbox; but still no cigar...
basically, I added to my button creation:
btn1.onMouseEnter = showTooltips
btn1.onMouseLeave = hideTooltips
Reason I want this: clicking the button will launch 'ieplorer' with search string, pointing to FRF CE table topic in question (to get more info).
I hate it when programs launch stuff without warning, hence the "button"-tip...
ps: if this could work for a bitmap (or any other means), that would be fine too... (did try already though...)
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Sat Oct 24, 2020 5:48 am Post subject: |
|
|
@paul44. For the buttons, panel, image, etc except CEEdit, no need use the custom show tooltips function, because they have their own tooltip already, it's call 'Hint'.
So, just make:
| Code: | btn1 = createButton(f)
btn1.setPosition(10,100)
btn1.ShowHint = true
btn1.Hint = 'This is button1 or what ever'
img1 = createButton(f)
img1.setPosition(10,130)
img1.ShowHint = true
img1.Hint = 'Go to website'
img1.Picture.loadFromStream(findTableFile('blablabla.jpg').stream)
|
By setting the Hint property to true, the tooltips will automatic show and hide when mouse enter or left the components.
Especially for CEEdit, they contain a bug, the tooltip not show properly as usually. That is why I made the custom tooltip function.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Sat Oct 24, 2020 7:56 am Post subject: Solved... |
|
|
^ Thx a mil. my problem was that I did not know the correct property(name). I knew about the 'ShowHint' - quite a few articles on that subject ~ within UDF1 context - but nothing about '.Hint' property.
just tested, and working...
cheers
ps: what is the best approach - besides asking ofcourse - to find "all" properties & methods for any class? (even if that means searching through source code)
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Sat Oct 24, 2020 12:31 pm Post subject: |
|
|
Test: Try to create a form and add some components to the form and access the code below.
Note : I made a form using form designer and didn't change any components name. So, by default my form name is UDF1
| Code: | -- get how many components have by a form
local count = UDF1.ComponentCount
print(count)
-- to print all components name owner by a form
for i = 0 , count-1 do
-- print(<form name>.Component[i].Name)
print(UDF1.Component[i].Name)
print(UDF1.Component[i].getClassName())
end
-- to print all components class type owner by a form
for i = 0 , count-1 do
-- print(<form name>.getClassName())
print(UDF1.Component[i].getClassName())
end
-- to combine the last two commands
for i = 0 , count-1 do
local compname = UDF1.Component[i].Name
local classname = UDF1.Component[i].getClassName()
print('index: '..i..' is '..compname..' and the class is a '..classname)
end |
To make a list component class properties values and attributes, I don't know the simple way to do it via CE Lua.
But, if your form created using the CE form designer, then you can save your form as an LFM file via form designer menu.
Later, if you open your LFM file using a text editor like notepad, you will see the set of your form component class properties.
In other primitive way, you can use Lua script to list out a component class properties values, example:
| Code: | function getCompProp(frm)
local count = frm.ComponentCount
local comp
for i = 0, count-1 do
comp = frm.Component[i]
classname = frm.Component[i].getClassName()
--- switch cases:
if classname == 'TCEPanel' or classname == 'TPanel' then
print('Index no : '..i)
print('-------------------------')
print(comp.Name)
print(comp.getClassName())
print('-------------------------')
print('Align : '..comp.Align)
print('Alignment : '..comp.Alignment)
print('Anchors '..comp.Anchors)
print('Autosize : '..comp.AutoSize)
print('BorderSpacing : '..comp.BorderSpacing)
print('BevelInner : '..comp.BevelInner)
print('BevelOuter : '..comp.BevelOuter)
print('BevelWidth : '..comp.BevelWidth)
print('BidiMode : '..comp.BidiMode)
print('BorderWidth : '..comp.BorderWidth)
print('BorderStyle : '..comp.BorderStyle)
print('Caption : '..comp.Caption)
print('ChildSizing : '..comp.ChildSizing)
print('ClientHeight : '..comp.ClientHeight)
print('ClientWidth : '..comp.ClientWidth)
print('Color : '..comp.Color)
print('Constraints : '..comp.Constraints)
print('DockSite : '..comp.DockSite)
print('DragCursor : '..comp.DragCursor)
print('DragKind : '..comp.DragKind)
print('DragMode : '..comp.DragMode)
print('Enabled : '..comp.Enabled)
print('Font : '..comp.Font.Name)
print('Font Style : '..comp.Font.Style)
print('Font Size : '..comp.Font.Size)
print('Font Color : '..comp.Font.Color)
print('FullRepaint : '..comp.FullRepaint)
print('Height : '..comp.Height)
print('Left : '..comp.Left)
print('ParentBidiMode : '..comp.ParentBidiMode)
print('ParentColor : '..comp.ParentColor)
print('ParentFont : '..comp.ParentFont)
print('ParentShowHint : '..comp.ParentShowHint)
print('PopupMenu : '..comp.PopupMenu)
print('ShowHint : '..comp.ShowHint)
print('TabOrder : '..comp.TabOrder)
print('TabStop : '..comp.TabStop)
print('Top : '..comp.Top)
print('UseDockManager : '..comp.UseDockManager)
print('Visible : '..comp.Visible)
print('Width : '..comp.Width)
print('-------------------------')
elseif classname == 'TCEButton' or classname == 'TButton' then
-- bla bla bla...
elseif classname == 'TCEEdit' or classname == 'TEdit' then
-- bla bla bla...
end
end
|
Note :
1. the 'comp' will return error if the component class doesn't have the mentioned property. i.e: TButton doesn't have BevelInner, BevelOuter property, etc.
2. the 'comp' will return error if the component class is return a booelan value (true/false). i.e: comp.Visible, comp.Enabled, etc
However, CELua have function getProperty() and getPropertyList()
| Code: | r = getPropertyList(UDF1)
for i=0, r.Count-1, 1 do
print( r[i])
end |
Will list out all properties own by form UDF1
But, I don't know to get the property value.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Sun Oct 25, 2020 4:48 am Post subject: or maybe... |
|
|
thx, will be adding that to my 'test scripts' list..
and perhaps some smart guy could "scrape" all of this stuff: [ https://imgur.com/a/bgPnd97 ]... somehow...
tried even some "exotic ones", and they all showed up
|
|
| Back to top |
|
 |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Mon Nov 02, 2020 1:15 pm Post subject: List components w/ name & value... |
|
|
@Corroder: based on your feedback, spent some time on this: (see below)
since I'm gradually starting to get grip on this part of ce, I also did the same exercise on the Lua Window.
This list info will help me (and sure enough many other "beginners" like myself) a lot. Logically, the next step is to get a MethodList (see next part below; comes from a #ParkourPenguin post). As he stated in his post: you probably do not get all of them, AND you'll also get the 'inherited' ones.
Not sure if I make the effort to restrict the list to the Components 'unique' methods (as that is what I'm exactly looking for)...?!
(ps: did some googling: python has 'getMembers' for this purpose)
Regarding 'hiding menus': (from a #Dark Byte post)
[code]
[ENABLE]
{$lua}
local form = getLuaEngine()
if (luaMenu == nil) then luaMenu = form.Menu end
form.Panel1.Visible = false
form.Splitter1.Visible = false
form.Menu = nil // <= how to "hide" it...
{$asm}
[DISABLE]
{$lua}
form.Menu = luaMenu
[/code]
If you run this, you basically only leave the 'panel message' section, incl no_menu. The problem I'm now looking at is, how to restore the menu without restarting CE.
fyi, tried this: (save ptr menu object, then restore it ?)
[code]
local luaMenu = form.Menu
form.Menu = luaMenu
[/code]
Blame it on my lack of experience, if you will . Next runner up would be to make 'a copy' and use that. Whether or not this "drags along" the submenu_items remains to be seen...
-Solved-: script updated accordingly...
[code]
[ENABLE]
{$lua}
function propList(sComp)
if (sComp == nil) then return end
local r = getPropertyList(sComp)
for i=0, r.Count-1, 1 do
print(string.format('\t {%02d}: %-35s \t ~ \t %s', i, r[i], getProperty(sComp, r[i])))
end
end
-- ******************************
local mForm = getLuaEngine()
--local mForm = getMainForm()
local count = mForm.ComponentCount
print(string.format('[%s]: Components #: ', mForm.getClassName(), count))
print(string.format(' # %-15s ~ \t %s',"Class", "Component"))
for i = 0 , count-1 do
local compName = mForm.Component[i].Name
local className = mForm.Component[i].getClassName()
print(string.format('[%03d]: %-15s ~ \t %s',i+1,className, compName))
propList(mForm.Component[i])
break
end
-- Tip: leave the 'break' initially; it'll take some time to finish otherwise...
-- get list of methods..
for k,_ in pairs(getmetatable(mForm.Component[0])) do
print(k)
end
{$asm}
[DISABLE]
[/code]
big PS: why is it that inserted code does not show up as in prev posts? i'm using the code tags, but it does not seem to work for some reason...?
Last edited by paul44 on Wed Nov 04, 2020 1:13 am; edited 1 time in total |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Mon Nov 02, 2020 11:29 pm Post subject: |
|
|
#1. Lua engine menu to show / hide Lua 'debugger' part
| Code: | local leform = getLuaEngine()
function createOrGetBaseMenuItem(form)
if form==nil then return nil end
local baseItem = nil
if not form.Menu then baseItem = createMainMenu(form).Items
else baseItem = form.Menu.Items end
return baseItem
end
function addMemuItem(parent,caption)
if parent==nil then return nil end
local newItem = createMenuItem(parent); parent.add(newItem)
newItem.Caption = caption
return newItem
end
function StateCompactLEWindow(state)
leform = getLuaEngine()
control_setVisible(leform.Panel1, state)
control_setVisible(leform.Splitter1, state)
end
function _hide()
res.Caption = 'Hide'
leform.Panel1.Visible = false
leform.Splitter1.Visible = false
res.OnClick = _show
StateCompactLEWindow(true)
end
function _show()
res.Caption = 'Show'
leform.Panel1.Visible = true
leform.Splitter1.Visible = true
res.OnClick = _hide
StateCompactLEWindow(false)
end
baseMenuItem = createOrGetBaseMenuItem(leform)
res = addMemuItem(baseMenuItem,'Hide')
_hide() |
Note:
You need add a condition to check if 'show/menu' already exist or not to prevent it from create the same menu items,
#2. getPropList()
I am not sure and never try use this in CE Lua, but I often use it in Lazarus. So, like I said before, to get all properties own by a form is easy, but to get all the properties values, I don't know how to do this in CE Lua
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Wed Nov 04, 2020 1:05 am Post subject: Finalizing... |
|
|
^
1. Property values: not sure if that is what you mean, but I'm getting them prop_values just fine: see here [ https://imgur.com/a/YPj9R9V ].
(taken from the lua engine form testing - the 2nd part shows start of 'method_list' for just 1 component ~ long list with double entries, and no indication which ones are component-specific...)
Obviously (?!) this brings up a whole new bunch of questions ofc .
2. Show menu again: actually, my logic is correct. in fact, the script does exactly what it is supposed to do. What I missed was: on the 1st run, it works fine; but not anymore on following runs because... by then "my copy" got 'nil'-ed as well (my bad...). I've updated my prev post so one can safely test this... (btw: already implemented/tested in my table, and working as expected)
ps: "logically", this would also mean that if one - later on - alters that menu, those updates would/should be "picked up" in accordance (as the menu pointer itself should not have changed)... (not tested though)
ps2: planning to "dump" the propertyList into a spreadsheet, in order to compare resp. components: which are common/specific?! I'll update this post once done... in due time
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Nov 04, 2020 1:36 am Post subject: |
|
|
>> Property values.
As you know, example:
| Code: | r = getPropertyList(UDF1)
for i=0, r.Count-1, 1 do
print( r[i])
end
|
Will output all properties attributes has by the form UDF1, will look like this:
| Code: | Name
Tag
AnchorSideLeft
AnchorSideTop
AnchorSideRight
AnchorSideBottom
Cursor
Left
Height
Hint
Top
Width
HelpType
HelpKeyword
HelpContext
HorzScrollBar
VertScrollBar
Align
AllowDropFiles
AlphaBlend
AlphaBlendValue
Anchors
AutoScroll
AutoSize
BiDiMode
BorderIcons
BorderStyle
BorderWidth
Caption
ChildSizing
ClientHeight
ClientWidth
Color
Constraints
DefaultMonitor
DockSite
DragKind
DragMode
Font
FormStyle
Icon
KeyPreview
Menu
ParentBiDiMode
ParentFont
PixelsPerInch
PopupMenu
PopupMode
Position
ShowInTaskBar
Visible
WindowState
DoNotSaveInTable
|
but no 'value' for each proprerties there. For example, I can get UDF1 form width value with :
| Code: | w = UDF1.Width
print(w)
|
as so on for others properties. I believe a property have i.e: Parent, Classname, name, and attributes. So, what I meant about 'properties values' are the 'the value' for each attributes.
If the form and his components made using CE Form Designer and save as a LFM file then all properties valiues are store there.
Same as in Lazarus or Delphi, example:
| Code: | object frmLuaEngine: TfrmLuaEngine
Left = 436
Height = 338
Top = 344
Width = 570
HelpContext = 19
Caption = 'Lua Engine'
ClientHeight = 318
ClientWidth = 570
Menu = MainMenu1
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '2.0.6.0'
object GroupBox1: TGroupBox
Left = 0
Height = 182
Top = 0
Width = 570
Align = alClient
Caption = 'Output'
ClientHeight = 162
ClientWidth = 566
TabOrder = 1
object mOutput: TMemo
Left = 0
Height = 162
Top = 0
Width = 566
Align = alClient
ReadOnly = True
ScrollBars = ssAutoBoth
TabOrder = 0
end
end |
So, the question is 'How to output all properties values' using CE Lua script?. I don't know yet.
Why the property value is important to design a form or game trainer or apps?
I am usually write my script like this i.e :
| Code: | -- normal
Button1.Width = 100
Button1.Height = 30
Button1.Left = 10
Button1.Top = 10
--- now put second button symmetrical position below the Button1
Button2.Width = 100
Button2.Height = 30
Button2.Left = 10
Button2.Top = 50 --> 10 + 30 + space 10
|
I more like write like this:
| Code: | Button1.Width = 100
Button1.Height = 30
Button1.Left = 10
Button1.Top = 10
--- now put second button symmetrical position below the Button1
Button2.Width = 100
Button2.Height = 30
Button2.Left = Button1.Left
Button2.Top = Button1.Top + Button1.Height + 10
-- or
Button2.setSize(Button1.Width, Button1.Height)
Button2.setPosition(Button1.Left, Button1.Top + Button1.Height + 10)
|
Sometimes we try duplicate a form with his components to new form, and there we need to know all the properties values of source form.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Wed Nov 04, 2020 8:17 am Post subject: still confused :) |
|
|
^ so that we get on the same wavelength:
in your example, 'Button1.Width = 100' the property value = '100' ?!
if that is the case, i'm getting the feeling you did not check-up the 'imgur' link in my prev post?!
That said: i'm pretty sure if - for example - i change the window size of the form, it will reflect as well in that overview (iow the property_values will have been updated accordingly) in the new printout. Will try that out when back home...
(if not updated, those values would probably be 'default's. i highly doubt this is the case)
ps: i perfectly understand what you are doing with those buttons. in fact, i'm using the "same" technique to keep an image centered in the middle/bottom of the window.
ps2: what i have not seen yet, is stuff like:
Menu = MainMenu1
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
(but it is still early in the day...
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Nov 04, 2020 10:55 am Post subject: Re: still confused :) |
|
|
| paul44 wrote: | | ^ i'm getting the feeling you did not check-up the 'imgur' link in my prev post?! |
I did, first try, O get message that I can't reach the link you provided for safety reason. Then, I try again using my another machine with VPN, I reached the link. So, that is it. The class with their attributes value as shown on your picture on the link.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|