Contents of buttons

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Jean SERVANT
Posts: 4
Joined: Mon Jan 28, 2008 1:49 pm

Contents of buttons

Post by Jean SERVANT » Mon Jan 28, 2008 6:19 pm

With my Hypercards stacks, I could write and read the contents of the buttons.
With Revolution 1.1.1, I can read them (and, by changing momentarily the style, change them).
Could you tell me how to do with Revolution 2.8.1 ?

Thank you in advance

Jean SERVANT

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Jan 28, 2008 6:37 pm

Hi Jean,

How did you do this in Rev 1.1.1? If you tell this, I might be able to help you with Rev 2.8.1.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Jean SERVANT
Posts: 4
Joined: Mon Jan 28, 2008 1:49 pm

Post by Jean SERVANT » Mon Jan 28, 2008 7:17 pm

Hi Mark
Thank you for this reply.

In Rev 1.1.1,, i ask for Object Properties, then clicking the button called "Button" (at the top of window), then the menu called "Style" down to the article "Menu", then clicking on "Option" or "Popup".
Coming back to the Properties window, I click on the last top button (without name, on the right of the button called "Button").
Then I see the contents in a field under the article "Create Button Menu with contents". I can read and write in this field to change the contents of the button.

Regards

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Jan 28, 2008 7:41 pm

Hi Jean,

I don't understand what sense it makes to use the property inspector to change the "contents" of a button. Why do you want this?

If you want to save a string to a button, use a custom property.

You can access the contents of a button by script:

put btn 1
put the text of btn 1
set the text of btn 1 to "hello world"
put "hell world" into btn 1

The text property contains the text that you find under the Contents button in HyperCard.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Jean SERVANT
Posts: 4
Joined: Mon Jan 28, 2008 1:49 pm

Post by Jean SERVANT » Tue Jan 29, 2008 3:37 pm

Hi Mark,

Thank you for your reply.

As my english is pretty poor, I answer your question using french language.
Tell me if there is a problem !

Dans le contenu des boutons Hypercard, j'ai décrit sommairement l'action qui est déclenchée en cliquant sur le bouton. Ceci est utile car cette action (qui résulte du script du bouton) est parfois très complexe: elle demande une longue durée pendant laquelle l'ordinateur "travaille" et est indisponible pour d'autres tâches.

J'ai bien compris comment fixer et connaître le "text" d'un bouton mais " the text is not visible to the user unless the button is a button menu". Or mes boutons n'ont pas été créés comme "button menu" et il ne semble pas possible de modifier temporairement leur style dans Revolution 2.8.1

Merci cependant pour votre aide.

Truly yours

Jean

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Post by BvG » Tue Jan 29, 2008 4:37 pm

I'm not sure if this helps (and i don't tak french very well (or at all)), but I remember that in 1.1.1 one could change any button via the gui into a menu, or a normal button. Although this is still possible with the "style" proerty, the rev ide does not have all the possible styles in every button's inspector drop down anymore.

So if you want a menu button, then chose one of these buttons from the "tools" palette in the ide:

pulldown menu
option menu
combo box

To have a tab button, there's only the tab, and for every other button you can take a normal button.

If you want to change the style per script, i suggest you look the relevant documentation entry up.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Jean SERVANT
Posts: 4
Joined: Mon Jan 28, 2008 1:49 pm

Post by Jean SERVANT » Thu Jan 31, 2008 10:04 am

Hi Mark and BvG

With your help I succeed to find a very simple solution :

In the script of the button

on mouseDown
put the text of me
end mouseDown

optionally

on mouseUp
hide msg
end mouseUp


contents in Hypercard buttons is text in Revolution

Sorry you lost time answering my beginner's question !

Thank you once more !

Regards

jean SERVANT

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Jan 31, 2008 10:48 am

Hi Jean,

Your solution works in the IDE only. Why don't you simply edit the buttons and set their tooltips to their text properties?

You might even write a script to automate this. Such a script would look like this:

Code: Select all

on changeButtons
   repeat with x = 1 to number of buttons
      set the tooltip of btn x to the text of btn x
   end repeat
end changeButtons
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Off-Topic”