on CloseStack handler problem

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
ameguira@gmail.com
Posts: 22
Joined: Mon Apr 18, 2016 4:57 pm

on CloseStack handler problem

Post by ameguira@gmail.com » Tue Dec 25, 2018 2:12 pm

Hi All
I need to init a cd fld and a graph line widget
This is my script:

on closeStack
local tfile, tData, tvalues
// write data to a text file
if fld "results" of cd "results" is not empty then
// pay attention to pathname for mobile
put specialFolderPath("desktop") & "/Margins.txt" into tFile
open file tFile for text write
put fld "results" of cd "results" into tData
write tData to file tFile
close file tFile
//init graph line widget
put "" into fld "results" of cd "results"
put "0,0" & return after tValues
put "No data to display" into fld "Graphlabel" of cd "results"
set the graphData of widget "Line Graph" of cd "results" to tvalues
else
end if
end closeStack


It works fine with a btn (mouseup handler), but with "on CloseStack" handler, impossible to init my 2 objects (fld and widget), but writing the text file works fine !
I have no errors. Strange LC behaviour.
Thanks for help.
Albert MEGUIRA

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6715
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: on CloseStack handler problem

Post by dunbarx » Tue Dec 25, 2018 2:59 pm

Change the handler to "closeStackRequest".

This fires before the stack closes. I bet this will fix it.

Craig Newman

ameguira@gmail.com
Posts: 22
Joined: Mon Apr 18, 2016 4:57 pm

Re: on CloseStack handler problem

Post by ameguira@gmail.com » Tue Dec 25, 2018 5:41 pm

Thank you Graig
It works
Albert MEGUIRA

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”