Unable to edit a button LiveCode 9.6.4

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderator: Klaus

Post Reply
jsburnett
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 121
Joined: Fri Mar 09, 2007 9:47 pm

Unable to edit a button LiveCode 9.6.4

Post by jsburnett » Wed May 03, 2023 5:26 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10094
Joined: Fri Feb 19, 2010 10:17 am

Re: Unable to edit a button LiveCode 9.6.4

Post by richmond62 » Wed May 03, 2023 5:36 pm

Surely the first thing to do is update to the latest version of LiveCode.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Unable to edit a button LiveCode 9.6.4

Post by stam » Wed May 03, 2023 6:28 pm

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.
Last edited by stam on Wed May 03, 2023 7:58 pm, edited 2 times in total.

jsburnett
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 121
Joined: Fri Mar 09, 2007 9:47 pm

Re: Unable to edit a button LiveCode 9.6.4

Post by jsburnett » Wed May 03, 2023 6:38 pm

Thanks for the suggestion.
Upgraded and no luck.
John

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10094
Joined: Fri Feb 19, 2010 10:17 am

Re: Unable to edit a button LiveCode 9.6.4

Post by richmond62 » Wed May 03, 2023 7:00 pm

At the risk of coming across as totally cretinous:

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10315
Joined: Wed May 06, 2009 2:28 pm

Re: Unable to edit a button LiveCode 9.6.4

Post by dunbarx » Wed May 03, 2023 7:07 pm

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

jsburnett
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 121
Joined: Fri Mar 09, 2007 9:47 pm

Re: Unable to edit a button LiveCode 9.6.4

Post by jsburnett » Wed May 03, 2023 8:24 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Unable to edit a button LiveCode 9.6.4

Post by FourthWorld » Thu May 04, 2023 3:42 am

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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply