Page 1 of 1

Unable to edit a button LiveCode 9.6.4

Posted: Wed May 03, 2023 5:26 pm
by jsburnett
Hi,
Not sure if this is the correct forum, but I recently created button to send an email by script using:
put tsNetSmtpSync(tURL, tFrom, tRecipient, tEmailMessage, tResponseHeaders, tBytes, tSettings) into tResult

After editing the script and closing the script editor and saving the stack, I am unable to edit the button even when selecting and using the Pointer tool.

When using the Pointer tool, the button functions as if the browse tool were selected (run mode I believe its called).

I copied the script of the button and pasted to new button, same result.

I am able to edit the button with the community version of Livecode since an error is generated with the tsNetSmtpSync.

Any thoughts?

Was unable to attach the script so I pasted it as below. (except for my email credentials).
Cant even thing of anything that would cause this.

Thanks.

John Burnett

on mouseUp
local tUrl, tEmailMessage, tRecipient, tBody, tFrom, tTo, tCc, tSubject, tAttachments
local tSettings, tResult, tBytes, tResponseHeaders

answer "Send Message" && field "email_subject" with "No" or "Send"
if it is "No"
then
exit mouseUp
end if

-- Specify the e-mail server settings
put "-" into tUrl
put "-" into tSettings["username"]
put "-" into tSettings["password"]

-- Enable TLS for SMTP
put true into tSettings["use_ssl"]

-- Encode the e-mail message body
put mimeEncodeFieldAsMIMEMultipartDocument(the long id of field "email_message") into tBody

if field "attachment" is not empty
then
put field "attachemnt" into tAttachments[1]["filepath"]
end if

-- Encode the e-mail headers and body
put "DrBurnett@DrJB-MFP.online" into tFrom
put line 1 of field "eMail" into tTo
if tTo is empty
then
put line 1 of field "Phone" into tPhone
put tPhone & "@txt.att.net" into tTo
end if
put field "email_cc" into tCc
put field "email_subject" into tSubject

mimeEncodeAsMIMEEmail tBody, tFrom, tTo, tCc, tSubject, tAttachments
put it into tEmailMessage

-- Make tRecipient a list of all recipients (To and Cc)
put tTo & cr & tCc into tRecipient

-- Send the e-mail
put tsNetSmtpSync(tURL, tFrom, tRecipient, tEmailMessage, tResponseHeaders, tBytes, tSettings) into tResult

-- Check the result
if the first word of tResult is "tsneterr:" then
answer "Error" && tResult && "returned from server"
else
answer "E-mail sent"
put "" into field "attachment"
end if

put field "Last Name" into tLastName
put field "First Name" into tFirstName
put field "Chart" into tChart
put tLastName && tFirstName && tChart into tID
put tID & tTo & tSubject & the date && the time into tSendData
if field "Notifications" of card tID of stack "Patient Data" is empty
then
put tSendData into field "Notifications" of card tID of stack "Patient Data"
else
put tSendData & return before line 1 of field "Notifications" of card tID of stack "Patient Data"
end if
end mouseUp

Re: Unable to edit a button LiveCode 9.6.4

Posted: Wed May 03, 2023 5:36 pm
by richmond62
Surely the first thing to do is update to the latest version of LiveCode.

Re: Unable to edit a button LiveCode 9.6.4

Posted: Wed May 03, 2023 6:28 pm
by stam
jsburnett wrote:
Wed May 03, 2023 5:26 pm

After editing the script and closing the script editor and saving the stack, I am unable to edit the button even when selecting and using the Pointer tool.

When using the Pointer tool, the button functions as if the browse tool were selected (run mode I believe its called).
If the button is behaving like in browse tool the it’s a good bet that its cantSelect property somehow got set to true


You can of course test in the message box:

Code: Select all

Set the cantSelect of button <buttonName> to false
If that were the problem then that should fix it.

Even so, you can edit the script of any object through the msgBox:

Code: Select all

Edit the script of button <buttonName>
HTH
S.

Re: Unable to edit a button LiveCode 9.6.4

Posted: Wed May 03, 2023 6:38 pm
by jsburnett
Thanks for the suggestion.
Upgraded and no luck.
John

Re: Unable to edit a button LiveCode 9.6.4

Posted: Wed May 03, 2023 7:00 pm
by richmond62
At the risk of coming across as totally cretinous:

Have you tried to edit another button in the same stack?

Re: Unable to edit a button LiveCode 9.6.4

Posted: Wed May 03, 2023 7:07 pm
by dunbarx
I am unable to edit the button even when selecting and using the Pointer tool.
I am not clear. When in pointer tool mode, you can invoke, say, a "mouseUp" handler in the button, as you would expect to do with the browse too? Can you also do that with the browse tool?

You have to edit the script of that button by opening its script externally (like from the message box)? Can you select the button externally?

Does a new button work normally?

Craig

Re: Unable to edit a button LiveCode 9.6.4

Posted: Wed May 03, 2023 8:24 pm
by jsburnett
Thanks for all the posts and replies.
I missed the post by stam.
Yes the cantSelect property was true.
Set it to false and works like a charm.
Learned something new today, solved another problem. Great day.
Thanks.
John

Re: Unable to edit a button LiveCode 9.6.4

Posted: Thu May 04, 2023 3:42 am
by FourthWorld
Glad you got that worked out, John.

You're not the first person to have accidentally set the cantSelect.

I once tried to encourage them to swap that Inspector icon for something more commonly needed. Project Browser space is premium real estate, and things like lockLoc are far more valuable there - which is what a lock icon in a layout program usually signifies. Alas my best argument was uncompelling.

FWIW here's some background on that property:
https://forums.livecode.com/viewtopic.p ... 49#p149449