Page 1 of 1

Resizing Objects from an on mouseup script in a button

Posted: Fri May 29, 2020 8:56 am
by Lonnie
Hi folks, a newbee here, just learning. Thanks in advance for any suggestions!

I need to determine the height of the card stack, one that I've allowed to be resized, and I want get the height while in a button script. I want to resize, relabel and reposition a couple objects based on the value of global variable which is initially set to true and changed to false by clicking the above mentioned button. I'm trying to put together a stack of as many techniques as I can from all the training courses I've watched in the last couple months ... all into one app!

So I'm making an app to display a list of LiveCode Training videos in a data grid table. Ones I've found on YouTube and inserted into a tab delimited list text file. You click on a line item in the data grid to select the video you want to watch, click a button to jump to the next page which holds the browser widget.

I have a text field that is populated with the URL selected from the data grid and a button labeled "Load" to click to insert the URL into the browser. I could load it directly into browser widget but I want to give the option to use the URL code or the "Embeded Code" to view the video. So I added a button labeled "Change Mode" that changes the value of the global variable, gUseURL, from true to false and back again when clicked which handles the needed changes.

At the bottom of the card I add a label field saying "Enter URL" in two lines of text(45 height). Next to the label field is the text field that is populated with the selected URL, in a single line of text(30 height) all centered nicely. When my "Change Mode" button is clicked I want to change the label to read "Enter Embeded Code" in 3 lines (60 height) and because the embeded code is lengthy I want to resize the text field's height to 3 lines(60) as well. The idea is to click the "Change Mode" button then right click in the browser window and select Copy Embeded Code and paste that into the text field containing replacing the URL and then click on a "Load" button to now view the different version.

This brings up another unknown... how can I make a multi-line "answer" dialog pop up to explain the process to the user and have the "Ok" button that then hides the instructions. I tried "answer "Lots of text" & "Line 2 of text" & etc and got error Expression missing factor. Tried && got same error. There must be a symbol for a carriage reurn and line feed. I played with a label field and put the lengthy message into the "contents". Then tried "set the invisible of field "URLInfoLbl" to false" to display an invisible object it but I need an "Ok" button within label field to hide it again... not sure about that one.

I also added a button "Back to List" to take you back to the page with the data grid and at the same time I want to resize, relabel and reposition the two resized objects back to their original size and position.

To position these 2 objects properly from the bottom of a card I obviously need to determine the height of the card stack and store it into a local variable like tCardHeight, and do it from within the button script. And as mentioned above, I want to be able to resize the stack so, of course, the height is going to be unknown when one clicks the "Change Mode" button. If anyone wants to mess with this I'd be glad to share it ... I don't know how to other than by email. Let me know at Lonnie dot Hardesty at my gmail account.

Sorry for the lengthy explanation but you can never have too much info!!

Thanks again, in advance, for any suggestions ...

Lonnie

Re: Resizing Objects from an on mouseup script in a button

Posted: Fri May 29, 2020 4:58 pm
by dunbarx
I need to determine the height of the card stack, one that I've allowed to be resized, and I want get the height while in a button script.
The height of the card is, er, "the height of this card" (or, the height of card "cardReference")
In a running handler you can ask for the above at any time, or on any condition.
I want to resize, relabel and reposition a couple objects based on the value of global variable which is initially set to true and changed to false by clicking the above mentioned button.
Check out "location", "label", "rect", "height", "width", "top", and ALL the "related" words in the dictionary.
because the embeded code is lengthy I want to resize the text field's height to 3 lines(60)
Check out the "formattedHeight" in the dictionary.
how can I make a multi-line "answer" dialog
The answer dialog allows up to 7 responses, and the dialog text can be multi-line, but the responses are a series of buttons. Otherwise, You have to roll your own. There are a million ways to do this. Is a menu-type button to your liking?
To position these 2 objects properly from the bottom of a card I obviously need to determine the height of the card stack and store it into a local variable
You are probably, and don't take this the wrong way, doing a whole lot more work than you need to. This is perfectly normal with a new user, and actually helps in the learning process.

You have asked a lot of questions (and I probably misunderstood them all) and it was good to read about the scope of your project. Better, however, to post a series of specific issues, for example, you might have started with the multi-line dialog box alone.

Know that there is no limit to the amount of help you will get here. But please lets break this up into bite sized pieces, with you working through each one in turn until you are happy. So get back with comments on the few items I did address, and we will see how to make it all work.

Craig

Re: Resizing Objects from an on mouseup script in a button

Posted: Fri May 29, 2020 5:10 pm
by Klaus
Hi Lonnie,

what Craig said!
And yes, card size = stack size, so no matter what you query, it will be the same.

There is no "card stack" as you mentioned! :-D
To avoid misunderstandings, use the correct term.
This brings up another unknown... how can I make a multi-line "answer" dialog pop up to explain the process to the user and have the "Ok" button that then hides the instructions. I tried "answer "Lots of text" & "Line 2 of text" & etc and got error Expression missing factor. Tried && got same error.
You can add a "new line" to any text by adding a CR (= Carriage return = short for RETURN):

Code: Select all

...
put "This is line 1 of text" & CR & "This is line 2 of text" & CR & "This is line 3 of text" into tData
answer tData
...
Best

Klaus