I have spent 2 weeks in experimenting to revitalize a long handler (to select and create pictogram buttons from each of 14 textfields, offering their choices of pictograms&text). The handler has been functioning faithfully at least since 2009, in earlier versions of my application and earlier versions of livecode at least until livecode 4.5.1. But now and here, in developpping a new version of my application in Livecode 7.1.0 it went on an all-out strike.(I have controlled that the textfields to pick from are locked now as they were previously) -
I hesitate to burden your fine forum with the long script of the handler, but it seems a rational way to avoid wasting the time of potential helpers
Code: Select all
--making and managing glyph buttons start--------------------------------------------------------------------------------------------------
on buttonmake
global btfont
put word 2 of the clickLine into theLine
put the clickChunk into chunkInfo
if chunkInfo = empty then exit to top
--ask "Click Chunk" with chunkInfo
set the itemdelimiter to tab
put number of items in line theLine of target into itemCount
repeat with n = 1 to itemCount
put number of chars in item n of line theLine of target into line n of infoHold
--ask "number of chars in item" && n with line n of infoHold
end repeat
if theLine = 1 then put 1 into charStart
else put number of chars in line 1 to (theLine - 1) of target + 2 into charStart
put charStart into charStart2
repeat with n = 1 to itemCount
add line n of InfoHold to charStart2
put charStart2 into line n of ItemStart
--ask "Line Info" with line n of InfoHold
--ask "Itemstart" with line n of itemStart
end repeat
put charStart into ItemStart2
delete last line of ItemStart
put ItemStart into line 2 of ItemStart2
put 0 into x
put ItemStart2 into startRange
repeat with n = 1 to number of lines in startRange
add x to line n of startRange
add 1 to x
end repeat
put startRange into endRange
repeat with n = 1 to number of lines in endRange
add line n of infoHold to line n of endRange
end repeat
repeat with n = 1 to number of lines in endRange
put empty into startTest
if word 2 of chunkInfo >= line n of startRange then put "True" into startTest
put empty into endTest
if word 4 of chunkInfo <= line n of endRange -1 then put "True" into endTest
--ask "start Range" && word 2 of chunkInfo with line n of startRange
--ask "startTest" && n with startTest
--ask "endTest" && n with endTest
if startTest = "True" and endTest = "True" then
put n into itemNumber
-- ask "Line" && theLine && "Item Number" && itemNumber with
put item itemNumber of line theLine of target into lomme
if the result = "cancel" or it = empty then exit to top
-- put it into item itemNumber of line theLine of target
exit repeat
end if
end repeat
-- if the optionkey is down and the controlkey is up then
-- descriptiontext
-- end if
-- if the optionkey is down and the controlkey is down and movetext is empty then
-- chooseline
-- end if
-- if the optionkey is down and the controlkey is down and movetext is not empty then
-- placeline
-- end if
put lomme into picktext
put char 1 of picktext into btname
put empty into char 1 to 2 of picktext
if picktext is empty then
put "No description" into htext
else
put picktext into htext
end if
-- main window
if the phenowindow of me is mainwindow then
put "27,64,59,96" into knaprect
end if
create button in group ID 3655
set name of it to btname
set textfont of it to btfont
set textsize of it to 24
set textstyle of it to plain
set style of it to transparent
set the foregroundcolor of it to "black"
set rect of it to knaprect
put "on mouseup" into line 1 of scriptbox
put "if the optionkey is up and the keysdown is not in" && quote & 99,100,115 & quote && "then" into line 2 of scriptbox
put "ikonmsg" into line 3 of scriptbox
put "end if" into line 4 of scriptbox
put "end mouseup" into line 5 of scriptbox
put "on mousewithin" into line 6 of scriptbox
put "if the optionkey is down then" into line 7 of scriptbox
put "set the tooltip of me to" && quote & htext & quote into line 8 of scriptbox
put "end if" into line 9 of scriptbox
put "end mousewithin" into line 10 of scriptbox
put "on mousestilldown" into line 11 of scriptbox
put "if the optionkey is down then" into line 12 of scriptbox
put "set cursor to arrow" into line 13 of scriptbox
put "set loc of me to the mouseloc" into line 14 of scriptbox
put "end if" into line 15 of scriptbox
put "select empty" into line 16 of scriptbox
put "btnmsg" into line 17 of scriptbox
put "end mousestilldown" into line 18 of scriptbox
put "on doomed" into line 19 of scriptbox
put "send" && quote & deleteme & quote && "to me in 10 milliseconds" into line 20 of scriptbox
put "end doomed" into line 21 of scriptbox
set script of it to scriptbox
end buttonmake
--making and managing glyph buttons end-------------------------------------------------------------------------------------------------------

Hoping for advice
Best regards
Kresten