Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Can't change AutoSize on a Label

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
HenryEx
Advanced Cheater
Reputation: 1

Joined: 18 Dec 2011
Posts: 76

PostPosted: Fri Jul 17, 2015 8:21 am    Post subject: Can't change AutoSize on a Label Reply with quote

I'm trying to build my GUI entirely in LUA and have hit a problem:

I want to use labels of a certain size with word wrap, and for that i need to disable AutoSize which is on by default. It's easy in the form designer - switch it from True to False.
But there's no setAutoSize for the label class, and using setProperty( label, "AutoSize", "False" ) does nothing.
I tested getProperty( label, AutoSize ) and it apparently returns nil.

Is there no way to set AutoSize off without the form designer?
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Fri Jul 17, 2015 12:31 pm    Post subject: Reply with quote

Try label.AutoSize = false ?

Try set its control color or alignment to easier see the effect.

Code:
local b = createLabel(UDF1)
b.AutoSize,b.Name,b.Caption=false,'test','Hello'
b.Top,b.Width,b.Height,b.Alignment,b.Color,b.Font.Color=30,100,50,'taCenter',0x886644,0xffffff

_________________
- Retarded.
Back to top
View user's profile Send private message
HenryEx
Advanced Cheater
Reputation: 1

Joined: 18 Dec 2011
Posts: 76

PostPosted: Fri Jul 17, 2015 3:06 pm    Post subject: Reply with quote

Thanks, that works.

Is there any rhyme or reason as to when i can just use Object.Property to assign values (like with AutoSize here) and when i have to use setProperty( Object, Property, value )?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Fri Jul 17, 2015 3:52 pm    Post subject: Reply with quote

setProperty is obsolete and shouldn't be used, so when possible, use Object.Propertyname
_________________
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
View user's profile Send private message MSN Messenger
HenryEx
Advanced Cheater
Reputation: 1

Joined: 18 Dec 2011
Posts: 76

PostPosted: Sat Jul 18, 2015 7:52 am    Post subject: Reply with quote

As a counter example, i wanted to center some text on a panel.

panel.Alignment = "taCenter" didn't work, it was still left-aligned.
setProperty(panel, "Alignment", "taCenter") DID work, on the other hand.

Or is there some third option i`can use when Object.Propertyname doesn't work?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites