LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Linh
- Posts: 16
- Joined: Sun Mar 27, 2011 2:46 pm
Post
by Linh » Fri Dec 02, 2011 5:07 am
Good morning,
I want to create a new label object by code, not drag and drop from tools. Could I decide position, text color, content and name of this label? I tried to search, but I can't find any document about this, so I have to bother you guys again

.
Thank you,
Linh
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10305
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Fri Dec 02, 2011 5:28 am
Howdy.
Check up on the "create" command in the dictionary.
Craig Newman
-
Dixie
- Livecode Opensource Backer

- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
Post
by Dixie » Fri Dec 02, 2011 1:16 pm
Linh...
As Craig mentioned look at the 'create' command... also have a look at the 'templateField' keyword in the dictionary... The script below will create a 'label' field for you... say from within the script of a button, but there again... it could be from anywhere
Code: Select all
on mouseUp
set the text of the templateField to "label:"
set the width of the templateField to 100
set the height of the templateField to 21
set the visible of the templateField to true
set the dontwrap of the templateField to true
set the locktext of the templateField to true
set the threeD of the templateField to true
set the showfocusborder of the templateField to false
set the showborder of the templateField to false
set the traversalOn of the templateField to false
set the textAlign of the templateField to right
set the loc of the templateField to the loc of this card
create field "boo"
end mouseUp
Hope it helps...
Dixie
-
mwieder
- VIP Livecode Opensource Backer

- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
-
Contact:
Post
by mwieder » Fri Dec 02, 2011 7:09 pm
...and afterwards it's usually good form to

-
Dixie
- Livecode Opensource Backer

- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
Post
by Dixie » Fri Dec 02, 2011 8:11 pm
Mark...
I like it when I learn something new... thanks for that, it is something I had never considered...
take care
Dixie
-
mwieder
- VIP Livecode Opensource Backer

- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
-
Contact:
Post
by mwieder » Fri Dec 02, 2011 8:24 pm
I like to put things back the way I found them - it cuts down on surprises from the Law of Unintended Consequences.

-
Linh
- Posts: 16
- Joined: Sun Mar 27, 2011 2:46 pm
Post
by Linh » Wed Dec 07, 2011 2:27 am
Thank you very much. You're beautiful!
-
Linh
- Posts: 16
- Joined: Sun Mar 27, 2011 2:46 pm
Post
by Linh » Wed Dec 07, 2011 7:29 am
I'm sorry to ask you again. How could I delete all fields of a card by code? I tried 'select' and 'delete' keyword, but I only could delete one field / a time. Is there any keyword to select and delete all fields of a card?
Regards,
Linh
-
Linh
- Posts: 16
- Joined: Sun Mar 27, 2011 2:46 pm
Post
by Linh » Wed Dec 07, 2011 8:05 am
I found the solution
Code: Select all
clear card 2 of this stack
create card "normal_page"
Anyway thank you guys!
Linh
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Wed Dec 07, 2011 10:37 am
Hi Linh,
You can use this script to delete all flds
Code: Select all
on DelAllFlds
put the num of flds into nbF
repeat with i = nbF down to 1
delete fld i
end repeat
end DelAllFlds
Best regards
Jean-Marc
https://alternatic.ch