Complex itemDelimiter
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Complex itemDelimiter
Here's a side effect of my continuing development of my Devawriter Pro software:
- -
- -
- Attachments
-
- COMPLEX DELIMITER.livecode.zip
- Stack
- (1.27 KiB) Downloaded 57 times
Re: Complex itemDelimiter
Let me guess, you scripted:
Code: Select all
...
set itemdel to (CR & "-DO NOT EDIT THIS LINE-" & CR)
...
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Complex itemDelimiter
HOWEVER, as you can see, while the first line using
Code: Select all
set the unicodeText
the next line goes "all wonky" as it seems impossible to use set with after.
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Complex itemDelimiter
Aaaaaah, my favourite activity: answering my own posts:
What a headache.
Code: Select all
set the unicodeText of field "XYZ" to the unicodeText of field "ABC"
put (cr & "--Don't Mess Around--" & cr) after fld "XYZ"
set the unicodeText of field "XYZ" to ((the unicodeText of field "XYZ") & (the unicodeText of field "DEF"))
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Complex itemDelimiter
Of course, sooner or later, some end-user with sticky fingers is either:
1. Going to edit that line.
2. Delete one or both of the carriage returns.
-----
Read my next rant "Idiot-proofing a GUI."
-----
Is there a way to make certain lines in a field ineditable?
-
- VIP Livecode Opensource Backer
- Posts: 7227
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Complex itemDelimiter
The easiest way would be to put the top line into a locked field and the editable text below it in an unlocked one. Then you don't need delimiters.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Complex itemDelimiter
While that is a clever idea it will not work in this use-case as the end-user has to be able to edit ALL text before that
funky itemDelimiter, and ALL the text after it: and the itemDelimiter is used to work out where to dump the edited
sections of text once the end-user has finshed editing (i.e into 2 fields).
funky itemDelimiter, and ALL the text after it: and the itemDelimiter is used to work out where to dump the edited
sections of text once the end-user has finshed editing (i.e into 2 fields).
-
- VIP Livecode Opensource Backer
- Posts: 7227
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Complex itemDelimiter
So unlock the top field too.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Complex itemDelimiter
The 'point', as far as there is a point, is for the EDITOR thingy to be a bog-basic single field in a bog-basic substack,
and 95% of the time it only gets the text from one source field in the main monster stack: but this case is the exception.
So, wrestling with the "continue being clever" scenario [and the inevitable 'prawn' who will end up mucking around
with the funky itemDelim and then complain] and the far more goofy (but possibly more sensible) scenario of having
2 fields . . .
Probably have to bow my head and go for the goofy solution.
and 95% of the time it only gets the text from one source field in the main monster stack: but this case is the exception.
So, wrestling with the "continue being clever" scenario [and the inevitable 'prawn' who will end up mucking around
with the funky itemDelim and then complain] and the far more goofy (but possibly more sensible) scenario of having
2 fields . . .
Probably have to bow my head and go for the goofy solution.
Re: Complex itemDelimiter
no needrichmond62 wrote: ↑Sun Apr 03, 2022 7:44 pmProbably have to bow my head and go for the goofy solution.
put this in your field's script:
Code: Select all
constant kSeparatorText = "do not edit this line" -- or whatever segment of text is going to be unique to the separator line
on rawKeyDown pKeyCode
local tText
lock screen
set the dontWrap of me to true
put the text of the selectedLine into tText
if tText contains kSeparatorText then
set the dontWrap of me to false
else
set the dontWrap of me to false
pass rawKeyDown -- passing rawKeyDown allows text editing as normal
end if
end rawKeyDown
Hope that helps,
Stam
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Complex itemDelimiter
Thanks Stam, it does.
However, I chickened out:
-
However, I chickened out:
-
Re: Complex itemDelimiter
In fairness that looks like a better design...
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Complex itemDelimiter
Thanks.In fairness that looks like a better design...
I am obviously even more mental than I realised as I spent 8 hours wide awake in bed with that
blasted thing going round and round in my head.
- -
- Attachments
-
- INVERT.livecode.zip
- Stack.
- (1.01 KiB) Downloaded 50 times