Page 1 of 1
Complex itemDelimiter
Posted: Fri Apr 01, 2022 2:49 pm
by richmond62
Here's a side effect of my continuing development of my
Devawriter Pro software:
-
-
Re: Complex itemDelimiter
Posted: Fri Apr 01, 2022 3:51 pm
by Klaus
Let me guess, you scripted:
Code: Select all
...
set itemdel to (CR & "-DO NOT EDIT THIS LINE-" & CR)
...

Re: Complex itemDelimiter
Posted: Fri Apr 01, 2022 4:10 pm
by richmond62
Of course, Klaus; you're the man.
Re: Complex itemDelimiter
Posted: Sat Apr 02, 2022 5:38 pm
by richmond62

- SShot 2022-04-02 at 19.35.41.png (44.48 KiB) Viewed 6041 times

- SShot 2022-04-02 at 19.35.55.png (23.7 KiB) Viewed 6041 times
-
HOWEVER, as you can see, while the first line using
works well,
the next line goes "all wonky" as it seems impossible to use
set with
after.
Re: Complex itemDelimiter
Posted: Sat Apr 02, 2022 5:52 pm
by richmond62
Aaaaaah, my favourite activity: answering my own posts:
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"))
What a headache.

Re: Complex itemDelimiter
Posted: Sat Apr 02, 2022 6:37 pm
by richmond62

- SShot 2022-04-02 at 20.34.40.png (24.24 KiB) Viewed 6029 times
-
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?
Re: Complex itemDelimiter
Posted: Sun Apr 03, 2022 5:25 pm
by jacque
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.
Re: Complex itemDelimiter
Posted: Sun Apr 03, 2022 6:08 pm
by richmond62
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).
Re: Complex itemDelimiter
Posted: Sun Apr 03, 2022 7:00 pm
by jacque
So unlock the top field too.
Re: Complex itemDelimiter
Posted: Sun Apr 03, 2022 7:44 pm
by richmond62
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.

Re: Complex itemDelimiter
Posted: Sun Apr 03, 2022 11:43 pm
by stam
richmond62 wrote: ↑Sun Apr 03, 2022 7:44 pm
Probably have to bow my head and go for the goofy solution.
no need
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
this will stop editing of the line that contains kSepartorText, but all other lines will edit as expected.
Hope that helps,
Stam
Re: Complex itemDelimiter
Posted: Mon Apr 04, 2022 8:53 am
by richmond62
Thanks
Stam, it does.
However, I chickened out:
-
Re: Complex itemDelimiter
Posted: Mon Apr 04, 2022 9:03 am
by stam
In fairness that looks like a better design...
Re: Complex itemDelimiter
Posted: Mon Apr 04, 2022 9:08 am
by richmond62
In fairness that looks like a better design...
Thanks.
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.
-
-