Page 1 of 1

color selection

Posted: Wed May 07, 2014 6:17 am
by keram
Hi,

I found this lesson about a color picker swatch http://lessons.runrev.com/m/4071/l/7522 ... ker-swatch
and followed the steps in it.

The code in an opaque graphic on a card is:

Code: Select all

global gTheChosenColor
on mouseUp pBtnNum
    if pBtnNum is 1 then
        answer color with the effective backgroundcolor of me
        if the result is not "cancel" then
            put it into gTheChosenColor
            set the backgroundcolor of me to gTheChosenColor
        end if
     end if
     set the textColor of fld "fSample" to gTheChosenColor
end mouseUp
and after compiling the standalone no standard color-selection dialog box shows up.
It works OK in Windows but not in Android.

Any ideas why?

keram

Re: color selection

Posted: Wed May 07, 2014 6:52 am
by Simon
Hi keram,
"answer color" is not for mobile.

Simon

Re: color selection

Posted: Wed May 07, 2014 9:37 am
by keram
Thanks Simon,

Yeah, I overlooked it in the dictionary...
So what are the alternatives?
Three sliders adjusting the RGB values? That's little awkward...

I've seen in one app this nice colour picker:
colorpicker2.png
colorpicker2.png (14.35 KiB) Viewed 6493 times
but I don't know if it's possible to incorporate it into LC stack and how...

keram

Re: color selection

Posted: Wed May 07, 2014 9:46 am
by Simon
Hi keram,
I think you would use the "mousecolor", you have to make your own color pallet.

Simon

Re: color selection

Posted: Thu May 08, 2014 5:53 pm
by keram
Thanks Simon,

I was not aware of the mouseColor function.

I created now my own color picker with a palette (an image consisting of squares of different colors) and 2 radio buttons, one for changing the text color and the other for changing background color. I want to do it on certain selected cards only and just in some fields on these cards (cards are marked and the names of these fields start with letter f).

I'm using this code:

Code: Select all

global gTextColor, gBackColor
on mouseUp
   put the effective rect of img  "palette" of me into tPalette
   if the mouseH > item 1 of tPalette and the mouseH < item 3 of tPalette \ 
         and the mouseV > item 2 of tPalette and the mouseV < item 4 of tPalette then
      if the hilite of btn "font" of me then
         put the mouseColor into gTextColor
         set the textColor of fld "fSample" to gTextColor
      else if the hilite of btn "bckgr" of me then
         put the mouseColor into gBackColor
         set the backColor of fld "fSample" to gBackColor
      end if
   end if
   changeColor
end mouseUp

on changeColor
   set the itemDel to comma
   repeat with i = 1 to the number of cards of this stack
      if the mark of card i is true then
         put the name of cd i & comma after tMarkedCards
         if the hilite of btn "bckgr" of me then set the backColor of cd i to gBackColor
      end if
   end repeat
   
   repeat for each item tCard in tMarkedCards
      repeat with j = 1 to the number of flds of tCard
         if the hilite of btn "font" of me then
            if the short name of fld j of tCard contains "f" then set the textColor of fld j of tCard to gTextColor
         end if
      end repeat
   end repeat
end changeColor
It works perfectly in IDE and in Windows standalone but not at all in Android app.

What's wrong here?

keram

Re: color selection

Posted: Thu May 08, 2014 6:54 pm
by Klaus
And again a look into the dictionary brings full enlightment! 8)

Since there is no "mouse" on mobile, "the mousecolor" is only supported on desktop Mac, Win , Linux!

Re: color selection

Posted: Thu May 08, 2014 7:47 pm
by jacque
There may be an error in the dictionary, it says mousecolor works on mobile. Or else there's a bug in the engine. One of them is wrong.

Edit: I'm looking at the 6.6.1 dictionary. Maybe it's been changed in later versions?

Re: color selection

Posted: Thu May 08, 2014 10:59 pm
by Klaus
Oops, yes, sure, sorry for that, no idea where I had been looking? :oops:

But maybe you should try to use "mousedown" or "touchstart" instead of "mouseup"! 8)

Re: color selection

Posted: Thu May 08, 2014 11:11 pm
by Dixie
Klaus ...

The 'mouseColor' is supported on mobile... just ran in 6.6.2(rc3)
OOPS: apologies... I failed to notice that this was concerning Android :oops:

Re: color selection

Posted: Fri May 09, 2014 12:22 am
by Simon
Seems the "mouseColor" is broken on Android.
Returns 0,0,0 for all colors tested.

keram, will you bug report it?
Dixie's stack shows it.

Simon

Re: color selection

Posted: Fri May 09, 2014 1:29 am
by keram
Hello Friends,

Thanks for your valuable responses.
Dixie wrote:The 'mouseColor' is supported on mobile... just ran in 6.6.2(rc3)

Currently I'm using v. 6.5.2. I switched from v. 6.6.1 to this earlier version because I got "scared" by this posting:
http://ftp.runrev.com/forums/viewtopic. ... f3ca20002d
I simply don't want to create any sluggish apps... and my app will have few images in it, not moving but still...
Simon wrote:keram, will you bug report it?
Yes, I'll do it.

keram