Page 1 of 1

BackColor problem

Posted: Wed Aug 13, 2014 3:55 pm
by Maxiogee
In the script of a scrolling field with several lines of text I wrote…

Code: Select all

On mouseUp
   if the controlKey is up then
      put last word of (the value of the clickline) into numba
      go to card numba of stack "AllSingles"
   else
      put word 2 of the clickline into Lin
      if the backcolor of me = 255,255,255 then
         set the backcolor of line Lin of me to 255,0,150
      else
         set the backcolor of me to 255,255,255
      end if
   end if
end mouseUp
… expecting that the line would switch, with repeated clicking, between being highlighted and not being highlighted.

However, this is not what happens.
The line highlights, but a subsequent click does not unhighlight it.

When I query the field, through the message box …
> put the backcolor of line 2 of field "Last Highest"
it returns the word 'mixed'

In fact, with the line highlighted from above, when I ask the message box
put the backcolor of field "LastHighest"
it returns 255,255,255.

I cannot seem to script the field to accept the 'mixed' status as a case for reverting to a white background.

Any suggestions, please?

Re: BackColor problem

Posted: Wed Aug 13, 2014 5:23 pm
by dunbarx
Hi.

Do you have the "listBehavior" of your field set to "true"? This may interfere with the manual color changing you are trying to work. Set it to "false" (make sure that lockText is "true") and see if that helps.

Craig

Re: BackColor problem

Posted: Wed Aug 13, 2014 6:26 pm
by sritcp
Hi Maxiogee:

1. The existing backColor of lines in a field is empty; it is inherited from the backColor of the field unless you set it specifically.
So, if you change replace 255,255,255 with empty in your code, it should work.
The following code works:

Code: Select all

on mouseUp
   local tLine
   put word 2 of the clickLine into tLine
   if the backColor of line tLine of me is empty then
      set the backColor of line tLine of me to "yellow"
   else
      set the backColor of the clickLine to empty
   end if
end mouseUp
2. Note that mouseDown/mouseUp messages are only sent when you control-click within an unlocked field (i.e., not with simple clicks).
I am assuming that your field is locked.

Regards,
Sri.

Re: BackColor problem

Posted: Thu Aug 14, 2014 11:12 am
by Maxiogee
dunbarx wrote:Hi.

Do you have the "listBehavior" of your field set to "true"? This may interfere with the manual color changing you are trying to work. Set it to "false" (make sure that lockText is "true") and see if that helps.

Craig
The "listBehavior" is false
The field is not locked.

sritcp wrote: The following code works:

Code: Select all

on mouseUp
   local tLine
   put word 2 of the clickLine into tLine
   if the backColor of line tLine of me is empty then
      set the backColor of line tLine of me to "yellow"
   else
      set the backColor of the clickLine to empty
   end if
end mouseUp
Indeed it does. Many thanks.
sritcp wrote: 2. Note that mouseDown/mouseUp messages are only sent when you control-click within an unlocked field (i.e., not with simple clicks).
The field is not locked.

Thank you both.