Normal Topic @color on Command Button (Read 771 times)
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
@color on Command Button
Oct 11th, 2005 at 4:53pm
Print Post Print Post  
I have a command button that will switch to a "companion" record.

My records have an ID and an ALT ID element.  When a command button (ALT RECORD) is pressed it will retrieve the companion record.  That works just fine.

Now, I want to chage the color of the Command Button IF there is an ALT ID # on the current form (to alert the user that there is indeed a companion record).

I have tried variations of

Code
Select All
if not @isblank(Alt ID) then
@color(Alt Record,12,7) 



I have tried placing it in the elements of ALT ID and ALT RECORD on "form entry" and the results are the same.

While going through a group of records, the button remains the original color (black text on gray background) UNTIL I come to the first record with an entry in the ALT ID field. 

The color of the command button changes just as I wanted (to yellow text on a black background).  HOWEVER, from that point on the command button on every record (whether or not there is an ALT ID entry), appears as yellow text on the black background.

According to the programmers guide

Quote:
The color change remains effective only until you leave the current record.


I must be overlooking something; any ideas?  It's "driving me crazy."  (Can you tell? - lol)

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: @color on Command Button
Reply #1 - Oct 11th, 2005 at 5:20pm
Print Post Print Post  
I believe the documentation is incorrect and the color change is until the form is closed and re-opened. Add an Else statement to your If statement that changes the colors back.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: @color on Command Button
Reply #2 - Oct 11th, 2005 at 5:32pm
Print Post Print Post  
Ray -

Well, I feel a little better knowing that "it's not me."

It would be much more convenient (in my opinion) for the programming to work as stated in the documentation, so ...

... rather than changing the documentation to agree with the progamming

I would like to suggest that

.... the programming be changed to agree with the documentation.

I hope you'll pass that on for consideration.

Thanks.

Now ... I guess I'll have to use the slightly more complex RGBColor command - to be able to match my "original" form colors (which aren't available on the @color command).

Thanks much for the feedback -- I should be ble to handle it now.
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: @color on Command Button
Reply #3 - Oct 11th, 2005 at 6:22pm
Print Post Print Post  
Ray -

I'm still having a problem that I don't understand.  First, here's the coding I am currently using.

Code
Select All
If not @isblank(Alt ID)
then
RGBColor(Alt Record,0,0,0,0,255,0)
Else
RGBColor(Alt Record,-1,-1,-1,236,233,216) 



Here's what happens when I test it:

I retrieved a group of 8 records. 

Records #6 and #8 have an entry in the alt ID field.

I start on record #1 and advance through each record.  When I get to record #6 (which has an entry in the Alt ID), nothing happens.

When I get to record #7 (with a BLANK Alt ID), the command button changes color.

When I get to record #8 (which has an entry in the Alt ID), the button changed back to the "original" (incorrect, since there's an entry) color.

When I Alt/Tab to continue this message and then alt/tab back to record #8, the color has been changed to reflect the entry in the Alt/ID field.

When I "reverse" to record #7, the command button is the wrong color.

If I click anywhere on the form, the command button changes to the correct color.

I double checked to be sure that my programming was in the "on form ENTRY" (rather than "on form EXIT") and it is.

Now what?

By the way I tried the programming in both the Alt ID field and the command button field, but that made no difference.

The only thing I can think of trying (which I haven't yet) is to add a "throw focus" command.  I don't know whether that will do it or not but - even if it does - I don't understand why it should be necessary.
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: @color on Command Button
Reply #4 - Oct 11th, 2005 at 6:25pm
Print Post Print Post  
Hello Spencer,

Try

Code
Select All
If Not @IsBlank(Alt ID) Then
{
	RGBColor(Alt Record,0,0,0,0,255,0)
}
Else
{
	RGBColor(Alt Record,-1,-1,-1,236,233,216)
}
ForceRedraw() 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: @color on Command Button
Reply #5 - Oct 11th, 2005 at 6:44pm
Print Post Print Post  
Ray -

I've said it before, and I'll say it again:

YOU'RE THE GREATEST!

Now, I wonder how I would have known about forceredraw, though.  Might it not be a good idea to include it in the program documentation, in those cases where it is most likely to be needed?

I did read the documentation on forceredraw but it is not real specific.

Also, as an aside, I noticed the next command was forcecommit - something I may have use for and will have to "play" with next.  There's just no end to this learning process Smiley another good reason for Erika to get to the Tampa area, QUICKLY!  lol
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: @color on Command Button
Reply #6 - Oct 11th, 2005 at 8:21pm
Print Post Print Post  
Quote:
I would like to suggest that.... the programming be changed to agree with the documentation.
I think this suggestion is probably too late Spencer.  What would be done with all the existing programs that have been created/distributed? 

I doubt that it would be easy to change the program and still maintain backwards compatibility.

So I suspect we will see documentation corrections instead.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: @color on Command Button
Reply #7 - Oct 11th, 2005 at 8:37pm
Print Post Print Post  
Bob -

I'm surprised to think that the programming would have been used to "permanently" change the color for as long as the databse was open - since the documentation did say othersise.

I would, though, be very interested in hearing of the type of application and circumstances when it might be wanted.

Not withstanding that, I still think programming for a "temporary" change of color would still be valuable.  Sooooo, instead of CHANGING the existing command (if indeed it is determined not to be feasible) then I thnk that a NEW command (such as @colorrecord or @colortemp) should be made available to work as described.
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged