Re: How do I change the textcolor of the selected text in a native iOS field?

2021-04-15 Thread Ingar Roggen via use-livecode



From: use-livecode  on behalf of J. 
Landman Gay via use-livecode 
Sent: 15 April 2021 21:44
To: How to use LiveCode
Cc: J. Landman Gay
Subject: Re: How do I change the textcolor of the selected text in a native iOS 
field?

Yeah, I'm afraid you're right. I don't see any way set set a property on a 
range of characters
in a native input control. If the app doesn't strictly need copy/paste you 
could probably use a
LC field instead.

On 4/14/21 12:22 PM, William de Smet via use-livecode wrote:
> Thanks for pointing me to "selectedRange".
>
> put mobileControlGet ("field1", "selectedRange") into myTest
> -- answer myTest  //gives range 1,5
> mobileControlSet "field1", "textColor", "255,0,0"
>
> This doesn't work because all text will be colored and not just the
> selectedRange.
>
>
> greetings,
>
> William
>
>
>
>
> Op di 13 apr. 2021 om 21:11 schreef J. Landman Gay via use-livecode <
> use-livecode@lists.runrev.com>:
>
>> On 4/13/21 6:15 AM, William de Smet via use-livecode wrote:
>>> Hi there,
>>>
>>> How do I get the selectedText of a native iOS field?
>>> I want to change the color of the text selection in the field.
>>
>> I think you want "selectedRange" which returns the start index and the
>> length of the text
>> selected. Judging from the dictionary it looks like it only works on
>> multiline fields.
>>
>>
>> --
>> Jacqueline Landman Gay | jac...@hyperactivesw.com
>> HyperActive Software   | http://www.hyperactivesw.com
>>
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: On the dangers of automated refactoring

2021-04-15 Thread Curry Kenworthy via use-livecode


Andre:

> I like verbose code that is full of comments.

Ah yes, comments are good! But comments do not make code verbose.
Terse code can be heavily commented, and vice versa.
Commenting is not closely related to my issue, nor perhaps to yours.

Me:

> But there's an even bigger danger than the one already described:
> If a script needs many repeated changes to fix a single problem,
> usually that's because the code was not well-organized and modular.

Among all truly gigantic scripts that perform simple tasks,
usually you find habits of repetitive typing/pasting the same code.

For example, some people like to write out iterations themselves,
rather than using a repeat loop! It's like doing all the leg work.
"Hey Mr. Computer, let me do that for you!" But it creates problems.

Other people take a block of code or a handler for a task, copy it,
paste it, and make a few modifications again for a similar task.
And again. And again. Until there are dozens of similar blocks.

That works great until a problem shows up in one of the blocks.
After fixing it, congrats; only 49 other similar blocks to evaluate!

Each may require the same fix, or a slightly different fix, or none;
because each repeated code block or handler is a unique variation.
This turns what should be a tiny change into a mammoth undertaking. :)

Those are the habits that come back to haunt people later.
They are easy to avoid with good habits, harder to fix down the road!
That's why I'm careful to frequently warn about keeping code modular.

> Trying a "rename symbol” kind of procedure that acts on the
> whole script, might end up renaming the wrong variables.

I agree; it's a problem. Each portion of a script should be handled
with caution, with awareness of context, and with backups in place.
Keyhole surgery, first do no harm, are my approach to operating on code.

Good topic! Back to work

Best wishes,

Curry Kenworthy

Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting
http://livecodeconsulting.com/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Positioning object in a loclocked group (Klaus major-k)

2021-04-15 Thread thompsonmichael--- via use-livecode
Klaus:

 

I am working with LC 9.6.1 Indy on a Dell PC running Windows 10. I first
find a point in the group (in this case the topleft of btn "Button 1"

Adjust it  a little and then set the topright of the newly created button
"New Button". This would be the equivalent of your "where whateverX and Y
are definitively inside of that group"

 

The script below works on my setup:

There is a  loclocked group named "Display Group" with an image and a button
"Button 1"
A button labeled "Create and Place a New Button in Group 'Display Group' out
side the group has the following script:

on mouseUp
   Lock Screen 
   Put "Display Group" into tGroupName
   Put the width of btn "Button 1" of group tGroupName into tWidth
   Put the height of btn "Button 1" of group tGroupName into tHeight
   Create button "New Button" in group tGroupName
## Optional resizing of the new button
   Set the width btn "New Button" of group tGroupName to tWidth
   Set the height of btn "New Button" of group tGroupName to tHeight
## Get a point to locate the new button.
   Put the topLeft of btn "Button 1" of group tGroupName into tLocalTL
   Subtract 4 from item 1 of tLocalTL
## This tLocalTL is equivalent to your "whateverX,Y"
  Set the topRight of btn "New Button" of group tGroupName to tLocalTL
end mouseUp

 

This also works:

On MouseUp

Put "Display Group" into tGroupName

Put the rect of group tGroupName into tGroupRect

Put the loc of group tGroupName into tGroupLoc

Put 99,232 into tNewBtnLoc

--Put 400,400 into tNewBtnloc ## Try a point outside the rect of the
loclocked group

if tNewBtnLoc is within tGroupRect then

Create button "New Button" in group tGroupName

Set the loc of btn "New Button" to tNewBtnLoc

else Answer "The position of the New button would be outside the bounds of
the locked Group and therefore not visible on screen. Either unlock the
group or choose a new location within the rect of the group ("& tGroupRect
&")"

--Answer "tGroupLoc = "& tGroupLoc &"tGroupRect = "
& "tNewBtnLoc = "

end MouseUp

 

 

 

 

 

 

 

Michael R Thompson

 

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How do I change the textcolor of the selected text in a native iOS field?

2021-04-15 Thread J. Landman Gay via use-livecode
Yeah, I'm afraid you're right. I don't see any way set set a property on a range of characters 
in a native input control. If the app doesn't strictly need copy/paste you could probably use a 
LC field instead.


On 4/14/21 12:22 PM, William de Smet via use-livecode wrote:

Thanks for pointing me to "selectedRange".

put mobileControlGet ("field1", "selectedRange") into myTest
-- answer myTest  //gives range 1,5
mobileControlSet "field1", "textColor", "255,0,0"

This doesn't work because all text will be colored and not just the
selectedRange.


greetings,

William




Op di 13 apr. 2021 om 21:11 schreef J. Landman Gay via use-livecode <
use-livecode@lists.runrev.com>:


On 4/13/21 6:15 AM, William de Smet via use-livecode wrote:

Hi there,

How do I get the selectedText of a native iOS field?
I want to change the color of the text selection in the field.


I think you want "selectedRange" which returns the start index and the
length of the text
selected. Judging from the dictionary it looks like it only works on
multiline fields.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode




--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Positioning object in a loclocked group

2021-04-15 Thread J. Landman Gay via use-livecode
That happened to me once and it turned out that I had a duplicate invisible 
control that was moving instead. If you turn on "show invisibles" you might 
find something. The extra control may not even be in the same group.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On April 15, 2021 10:18:46 AM Klaus major-k via use-livecode 
 wrote:



Hi all,

I am sure there is a technical reason for this! 8-)

I have a group set to 600*600 pixel and loclocked.
Inside of the group there are two invisible objects,
a button and a graphic.

Now if I:
...
create btn "b1" in grp "THE group"
## and
set the loc of btn "b1" of grp "THE group" to whateverX,wahteverY
...
where whateverX and Y are definitively inside of that group!

Then the button stays however in the topleft corner of the group.
Even moving the button some pixels to right or down does not work.
Why, oh, why? :-)

Thanks for any insight!


Best

Klaus
--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Positioning object in a loclocked group

2021-04-15 Thread Klaus major-k via use-livecode
Hi Richard and all,

> Am 15.04.2021 um 18:07 schrieb Richard Gaskin via use-livecode 
> :
> 
> Klaus Major wrote:
>> I have a group set to 600*600 pixel and loclocked.
>> Inside of the group there are two invisible objects, a button and a graphic.
>> Now if I:
>> ...
>> create btn "b1" in grp "THE group"
>> ## and
>> set the loc of btn "b1" of grp "THE group" to whateverX,wahteverY
>> ...
>> where whateverX and Y are definitively inside of that group!
>> Then the button stays however in the topleft corner of the group.
>> Even moving the button some pixels to right or down does not work.
>> Why, oh, why? :-)
> 
> This is counter to my experience, but I may not be understanding the issue.
> If you have a simple sample stack that evidences this, I can take a moment 
> tonight to poke around and adjust the properties to set it right, and report 
> back what was needed.

Thank you for your kind offer!

I created a fresh stack with a grp and now it works!?

on mouseUp pMouseButton
  create button "b1" in grp "el_testo"
  set the loc of button "b1" of grp "el_testo" to the loc of this cd
end mouseUp

No idea what was wrong with my other stack?
Temporary hiccup maybe? :-)


> 
> -- 
> Richard Gaskin

Best

Klaus

--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Positioning object in a loclocked group

2021-04-15 Thread Mark Wieder via use-livecode

On 4/15/21 8:16 AM, Klaus major-k via use-livecode wrote:


Then the button stays however in the topleft corner of the group.
Even moving the button some pixels to right or down does not work.
Why, oh, why? :-)

Thanks for any insight!


Is it any different if you lock messages?

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Positioning object in a loclocked group

2021-04-15 Thread Richard Gaskin via use-livecode

Klaus Major wrote:

I have a group set to 600*600 pixel and loclocked.
Inside of the group there are two invisible objects, 
a button and a graphic.


Now if I:
...
create btn "b1" in grp "THE group"
## and
set the loc of btn "b1" of grp "THE group" to whateverX,wahteverY
...
where whateverX and Y are definitively inside of that group!

Then the button stays however in the topleft corner of the group.
Even moving the button some pixels to right or down does not work.
Why, oh, why? :-)


This is counter to my experience, but I may not be understanding the issue.

If you have a simple sample stack that evidences this, I can take a 
moment tonight to poke around and adjust the properties to set it right, 
and report back what was needed.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Positioning object in a loclocked group

2021-04-15 Thread Klaus major-k via use-livecode
Hi Stepehen,

> Am 15.04.2021 um 17:32 schrieb Stephen Barncard via use-livecode 
> :
> 
> Well for one thing there’s a keyword in the name of the object.
> Try using a name like “TheGroup”

since this is a string, it does not matter!
The actual name of my group is "galerie_km", but that does not change anything.


Best

Klaus
--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Positioning object in a loclocked group

2021-04-15 Thread Stephen Barncard via use-livecode
Well for one thing there’s a keyword in the name of the object.

Try using a name like “TheGroup”



On Thu, Apr 15, 2021 at 08:17 Klaus major-k via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Hi all,
>
> I am sure there is a technical reason for this! 8-)
>
> I have a group set to 600*600 pixel and loclocked.
> Inside of the group there are two invisible objects,
> a button and a graphic.
>
> Now if I:
> ...
> create btn "b1" in grp "THE group"
> ## and
> set the loc of btn "b1" of grp "THE group" to whateverX,wahteverY
> ...
> where whateverX and Y are definitively inside of that group!
>
> Then the button stays however in the topleft corner of the group.
> Even moving the button some pixels to right or down does not work.
> Why, oh, why? :-)
>
> Thanks for any insight!
>
>
> Best
>
> Klaus
> --
> Klaus Major
> https://www.major-k.de
> https://www.major-k.de/bass
> kl...@major-k.de
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
-- 
--
Stephen Barncard - Sebastopol Ca. USA -
mixstream.org
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Positioning object in a loclocked group

2021-04-15 Thread Paul Dupuis via use-livecode
I find positioning objects by script inside a location locked groups to 
be very non-intuitive as well.


I wish there was a mode by which all object in a group - in the special 
mode - could be set and referenced by coordinates relative to the group. 
Something like


set the relative loc of btn X in group Y to 120,120 -- places the center 
of the button 120px right and down from the left, top of the group 
(where ever that is)



On 4/15/2021 11:16 AM, Klaus major-k via use-livecode wrote:

Hi all,

I am sure there is a technical reason for this! 8-)

I have a group set to 600*600 pixel and loclocked.
Inside of the group there are two invisible objects,
a button and a graphic.

Now if I:
...
create btn "b1" in grp "THE group"
## and
set the loc of btn "b1" of grp "THE group" to whateverX,wahteverY
...
where whateverX and Y are definitively inside of that group!

Then the button stays however in the topleft corner of the group.
Even moving the button some pixels to right or down does not work.
Why, oh, why? :-)

Thanks for any insight!


Best

Klaus
--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Positioning object in a loclocked group

2021-04-15 Thread Klaus major-k via use-livecode
Hi all,

I am sure there is a technical reason for this! 8-)

I have a group set to 600*600 pixel and loclocked.
Inside of the group there are two invisible objects, 
a button and a graphic.

Now if I:
...
create btn "b1" in grp "THE group"
## and
set the loc of btn "b1" of grp "THE group" to whateverX,wahteverY
...
where whateverX and Y are definitively inside of that group!

Then the button stays however in the topleft corner of the group.
Even moving the button some pixels to right or down does not work.
Why, oh, why? :-)

Thanks for any insight!


Best

Klaus
--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: On the dangers of automated refactoring

2021-04-15 Thread Andre Garzia via use-livecode
I like verbose code that is full of comments. I often have to revisit code that 
has been made by me five or even ten years ago, and usually never touched again 
since then. I need to be able to understand it without relying on my memory 
from way back when. That is why I often prefer code that is easier to maintain 
and understand over terse code.

I understand that Jacque is not advocating for terseness, just for doing 
maintainable small codebases, which is exactly how I like to operate as well. 
In my mind, if a function is growing longer than the screen, then it is a 
really good candidate for breaking it up into smaller functions. 

As for the shadowing problem on the codebase I’m working, it is not really by 
design, it is how the code evolved. Mistakes were made, and now we’re all 
fixing them. It is just a good example how an attempt of RegEx based 
refactoring failed because the codebase had gotchas in it that I haven’t 
noticed before doing extensive refactoring and breaking stuff.

Variable shadowing is a dangerous thing, for me it sits alongside globals as 
king and queen of the kingdom of "stuff that will come back to haunt you”. 

And that is the main issue: Without a more comprehensive knowledge of the code 
in a script, you can’t really assume that all variables with the same name, 
point to the same variable. Trying a "rename symbol” kind of procedure that 
acts on the whole script, might end up renaming the wrong variables. That is 
part of what happened to me. This is specially dangerous when globals are 
involved, as the global is renamed in a script but maybe not in others. In 
systems that load and unload stacks in demand, you can’t be sure that all 
occurrences of that global are in memory for you to search, there might be 
stacks lying on disk that use it that you’re not aware. This can happen on 
large codebases that are trying to save memory by being smart with what they 
put in memory. As you can see, this has also happened to us.

> On 14 Apr 2021, at 23:19, Bob Sneidar via use-livecode 
>  wrote:
> 
> For my part, I call a function and put the result into a variable. I try not 
> to nest fucntions because I cannot easily tell what the result of each 
> function is, making it harder to troubleshoot, and also to read my own code! 
> For that reason my code is fairly verbose. 
> 
> Bob S
> 
> 
>> On Apr 14, 2021, at 13:06 , Curry Kenworthy via use-livecode 
>>  wrote:
>> 
>> Me:
>> 
 The biggest code is the most repetitive and least modular!
>> 
>> Jacqueline:
>> 
>>> Not always, but often. I try to aim for the smallest code base,
>>> so I think the contest should be to solve a complex problem
>>> with the least amount of code.
>> 
>> Yes, but not brevity for its own sake! Rather for maintainability,
>> efficiency, and to avoid the code-org messes that people try to
>> refactor their way out of after practicing bad habits.
>> 
>> The optimal balance of brevity with performance, readability, and 
>> maintainability is where we'll find the best code!
>> 
>> That'll be fairly tight code, but not always the very smallest.
>> I do love concise code; I've seen some whopping humongous scripts! :)
>> 
>> Best wishes,
>> 
>> Curry Kenworthy
>> 
>> Custom Software Development
>> "Better Methods, Better Results"
>> LiveCode Training and Consulting
>> http://livecodeconsulting.com/
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode