Tooltip background color change capability

Currently using a Canvas to draw Tooltip info into. To provide an improved user experience I need to be able to change the color on a Tooltip depending on its x-y location. I have tracking capability that changes the Tooltip text depending on its x-y position there by giving an opportunity to change the color. Then I could control background color that would be driven by text content.

Is there a way to control background color?

[quote=146791:@Carl Fitzsimmons]Currently using a Canvas to draw Tooltip info into. To provide an improved user experience I need to be able to change the color on a Tooltip depending on its x-y location. I have tracking capability that changes the Tooltip text depending on its x-y position there by giving an opportunity to change the color. Then I could control background color that would be driven by text content.

Is there a way to control background color?[/quote]

Right now, how are you drawing the background of your canvas ? FillRect ?

Carl,

Like Michel posted above me if you are using the canvas to simulate a tooltip then use the canvas.paint and then fillrect to color the background.

g.forecolor = RGB(180,180,180)
g.fillrect(0,0,me.width,me.height) 

Thanks for your replies - I may have stated what I was doing incorrectly.

I have a Canvas that has an image. Depending on the x-y location a Tooltip is presented using Tooltip.Show method i.e.

Tooltip.Show(TTipMessage,TTipXPos,TTipYPos,False)

The ‘Tooltip’ comes from a continuos timer event that checks if Tooltips should be shown. This boolean is tracked and set by a ‘Mouse Move’ Event Handler which checks the Canvas local x-y coordinates. When the x-y coordinates are within a circles diameter (there are multiple instances of these location diameters so many different ‘Tooltips’ can be displayed when the mouse is moved over and the Timer event fires) then the tool tip is displayed.

From your responses you may have brought up an interesting thought. How to implement a Help Message that utilizes drawing a rectangle and filling it with text (in my case I need multi line capability) and a background color with or without transparency. Not sure how to implement that

What I was looking for is a way to change a Tooltip background color. Considering this is a shared class I was looking for a way to expand on the Tooltip class to include background color or directly access the Tootip background color

[quote=146821:@Carl Fitzsimmons]Thanks for your replies - I may have stated what I was doing incorrectly.

I have a Canvas that has an image. Depending on the x-y location a Tooltip is presented using Tooltip.Show method i.e.

Tooltip.Show(TTipMessage,TTipXPos,TTipYPos,False)

The ‘Tooltip’ comes from a continuos timer event that checks if Tooltips should be shown. This boolean is tracked and set by a ‘Mouse Move’ Event Handler which checks the Canvas local x-y coordinates. When the x-y coordinates are within a circles diameter (there are multiple instances of these location diameters so many different ‘Tooltips’ can be displayed when the mouse is moved over and the Timer event fires) then the tool tip is displayed.

From your responses you may have brought up an interesting thought. How to implement a Help Message that utilizes drawing a rectangle and filling it with text (in my case I need multi line capability) and a background color with or without transparency. Not sure how to implement that

What I was looking for is a way to change a Tooltip background color. Considering this is a shared class I was looking for a way to expand on the Tooltip class to include background color or directly access the Tootip background color[/quote]

The Tooltip background AFAIK is controlled by the OS. For example in Mavericks the tooltip color is that ugly yellow and in Yosemite the tooltip background is a nice clean gray color. Using a custom canvas may be a nice option to give yourself the freedom of background color, but with the added overhead of controlling the fade in/out with timers.

The app will be cross platform. Having a consistent background color improves ‘How To’ documentation plus it improves the overall user experience. That is why I was looking for a way to do this via the IDE so a consistent color would be applied

You can create a custom Canvas Class and then add custom Color Properties to the Inspector Behavior which will give you control on your Subclass to choose the colors via the IDE.

Here is an example of a class I wrote which implements custom properties on the IDE. HTH.

https://www.dropbox.com/s/psqnygvvkl3no32/AutoCompleteTextField.zip?dl=0

This code piece Dim leadCommandText as String = messToProcess(0) throws an out of bounds exemption when clicking on an entry to auto fill

Also not sure how this can be used as a Tooltip where x-y location is needed to display the text. I might need to re think what appeared to be a simple need to implementing something completely different

Try this:
https://www.dropbox.com/s/dava4zmmgqk4cbe/tooltip%20window.xojo_binary_project?dl=0

I made a window subclass with mTooltip, BackgroundColor, and mTextColor properties. Then in the window paint event I resize the window and draw the text. You simply have to add a timer to the main window to move and show/hide the tooltip window. Since its a window it will be xplat and you can have whatever crazy colors you want!

[quote=146831:@Carl Fitzsimmons]This code piece Dim leadCommandText as String = messToProcess(0) throws an out of bounds exemption when clicking on an entry to auto fill

Also not sure how this can be used as a Tooltip where x-y location is needed to display the text. I might need to re think what appeared to be a simple need to implementing something completely different[/quote]

If you are unsure about using a canvas, you can use a container control

  • Drag a container control over CONTENTS
  • Select the container control
  • Place a rectangle of the desired color over it
  • On top of the rectangle, place a multiline label

Make the size so it looks like you want.

Drag the container control over the page. You address the text as MyContainer.Label1.Text.

[quote=146831:@Carl Fitzsimmons]This code piece Dim leadCommandText as String = messToProcess(0) throws an out of bounds exemption when clicking on an entry to auto fill

Also not sure how this can be used as a Tooltip where x-y location is needed to display the text. I might need to re think what appeared to be a simple need to implementing something completely different[/quote]

Sorry Carl I posted this as I was running out the door for yet another thanksgiving dinner :slight_smile: no this project I posted has Nothing to do with your tooltip scenario and I posted it as an example using the Inspector Behaviour for a class/subclass. Also thanks for finding a bug as I need to recreate that :slight_smile:

This skips the append when 1 line is selected which would result in a Ubound of -1 for messToProcess(0)

I changed this line for i as integer = 1 to TotalNumofSegments -1 to this for i as integer = 1 to TotalNumofSegments and it seemed to work. Not sure if thats what you were needing to do. I just took a quick look at this.

[quote]Try this:

I made a window subclass with mTooltip, BackgroundColor, and mTextColor properties. Then in the window paint event I resize the window and draw the text. You simply have to add a timer to the main window to move and show/hide the tooltip window. Since its a window it will be xplat and you can have whatever crazy colors you want![/quote] I will most definitely check this out - thanks

[quote=146986:@Carl Fitzsimmons]Mike - do I hear that. Potentially the problem/bug might be that the array messToProcess(0) has a Ubound of -1. The line picked shows correctly I could be wrong but this piece appears where a problem may be for i as integer = 1 to TotalNumofSegments-1
This skips the append when 1 line is selected which would result in a Ubound of -1 for messToProcess(0)

I changed this line for i as integer = 1 to TotalNumofSegments -1 to this for i as integer = 1 to TotalNumofSegments and it seemed to work. Not sure if thats what you were needing to do. I just took a quick look at this.

I will most definitely check this out - thanks[/quote]
Thanks Carl! I had purposely done that, but I can’t recall if that need is no longer valid. I wil revisit that project today. (I have been modifying that code in another project much more so I will revamp the open source version also :slight_smile: )

Thanks again!

#Jason,
Just got around to this part of the code and made a few changes. Instead of traveling i recognize the area in the canvas and place the tooltip in a static small offset location, works real nice. Changes can be made to background-text color, backdrop color of display window and I added a way to identify EndOfLine detection to the message which adds height to the tooltip window. I can see making this real slick by adding some of these parameters to a preferences file and load at startup.

#Mike,
Give me a shout if you get around to any changes. Always interested in seeing how to improve what I do

Thanks to everyone for all suggestions and examples

[quote=158932:@Carl Fitzsimmons]#Jason,
Just got around to this part of the code and made a few changes. Instead of traveling i recognize the area in the canvas and place the tooltip in a static small offset location, works real nice. Changes can be made to background-text color, backdrop color of display window and I added a way to identify EndOfLine detection to the message which adds height to the tooltip window. I can see making this real slick by adding some of these parameters to a preferences file and load at startup.

#Mike,
Give me a shout if you get around to any changes. Always interested in seeing how to improve what I do

Thanks to everyone for all suggestions and examples[/quote]

Carl thanks I have made the error/bug changes thus far, but those changes haven’t made the github open project yet. I am writing software for Arista Networks and that package is where this is at for now. Let me know if you need it sooner

Thanks!

#Mike,
Thanks - I am good for now, give me a shout when ready. More interested in the CTI-JTAPI-XML from another conversation which at this time only needs off hook event notification for specific devices on a CUCM implementation.

[quote=159582:@Carl Fitzsimmons]#Mike,
Thanks - I am good for now, give me a shout when ready. More interested in the CTI-JTAPI-XML from another conversation which at this time only needs off hook event notification for specific devices on a CUCM implementation.[/quote]
:wink: We are a member of Cisco DevNET which gives us (our Java guys) everything Java and C++… I am still trying to figure out how to make the JTAPI/TAPI work in xojo personally… If I can make any progress you will be the first to know… One of our Programmer has controlled UCM and the Phone using C# so I figure somehow Xojo may have a chance… :slight_smile: Cisco would make our lives easier if they would have standardized on a RESTful interface for their UC products …

yeah their job is to make it harder for everyone so you will buy their software. or pay them to integrate their stuff with your environment. they need to make some way.

Do I hear that. I just completed an update to my all device detail bat tool for CUCM v10.x. Many many changes to column headers as well as differences in some RegEx tests.

Most definitely interested in hearing from you on this. If a way-method could exist in XOJO to develop CTI-JTAPI-XML telephony capabilities this would open a much needed door. Energy your way for success as soon as possible :slight_smile: