Tooltip in a combo box?

Tooltip in a combo box?

Postby hag » Thu Oct 21, 2010 2:43 pm

I'd like to display a tooltip for each line of a combo box as the user scrolls down the list or puts mouse on the item a tooltip appears.
here is the structure of the combobox
Code: Select all  Expand view
REDEFINE COMBOBOX OCBX1 VAR cPandl1 ITEMS { "         < Other Activity Items >",;
         "Amortization of prepaid expenses"                           ,;
         "Credit line financing and Interest expense"                 ,;
         "Due to from owners/affiliate and Interest owners"           ,;
         "Expense as a percent of change in net assets"               ,;
         "Interest on cash balances"                                  ,;   
         "Investment activity and Revenue From Investments"           ,;
         "Notes rec'able amortization and Interest income"            ,;
         "Sale of equipment and Gain or loss on the sale of assets"   ,;
         "Service contracts receivable and Service income"            ,;
         "Start up expenses"                                          ,;
         "Term loan amortization and Interest expense"                };
         ID 19 OF oDlg on change(asetfilter(.f.,obrw),setup1(cPandl1,10,oDlg,nNewVar),mmcurrec := gl->(recno()),openfilter := .f.,;
         asetfilter(.f.,obrw),oDlg:show()                             ,;
         setcalc2(obrw,odlg,2)                                        ,;
         fixIt(oDlg,oBrw,oCbx1),setTheOrder(),WhatUsing(oDlg),gl->(dbgotop()),oBrw:setfocus())         ;
         UPDATE
 


Thanks in advance..
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Tooltip in a combo box?

Postby James Bott » Thu Oct 21, 2010 4:06 pm

Harvey,

Unfortunately, there is only one tooltip per control. Doing what you want would require major changes to the combobox class.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Tooltip in a combo box?

Postby hag » Thu Oct 21, 2010 4:52 pm

Thanks James.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Tooltip in a combo box?

Postby ukoenig » Thu Oct 21, 2010 6:38 pm

Harvey,

I added some Lines in ON CHANGE.
It shows different Tooltips in Relation to the selected Combobox-Row.

Image

REDEFINE COMBOBOX oCbx1 VAR cItem1 ITEMS { "One", "Two", "Three" } ;
ID ID_SIMPLE OF oDlg ;
ON CHANGE ( cItem4 := cItem1, oSay:Refresh(), ;
IIF( oCbx1:nAt = 1, oCbx1:oGet:cTooltip := "Tooltip Row-position 1", NIL ), ;
IIF( oCbx1:nAt = 2, oCbx1:oGet:cTooltip := "Tooltip Row-position 2", NIL ), ;
IIF( oCbx1:nAt = 3, oCbx1:oGet:cTooltip := "Tooltip Row-position 3", NIL ) ) ;

VALID ( cItem4 := cItem1, oSay:Refresh(), .t. )

It works, but maybe still something to include.
Maybe possible without selecting a Item ( using Mouse-Cursor-position )

Another Solution could be : showing a Message ( 2 Seconds ) on Row-change.

Image

REDEFINE COMBOBOX oCbx1 VAR cItem1 ITEMS { "One", "Two", "Three" } ;
ID ID_SIMPLE OF oDlg ;
ON CHANGE ( cItem4 := cItem1, oSay:Refresh(), ;
IIF( oCbx1:nAt = 1, MsgWait( "Message-Test 1", "Row Position 1", 2 ), NIL ), ;
IIF( oCbx1:nAt = 2, MsgWait( "Message-Test 2", "Row Position 2", 2 ), NIL ), ;
IIF( oCbx1:nAt = 3, MsgWait( "Message-Test 3", "Row Position 3", 2 ), NIL ) ) ;

VALID ( cItem4 := cItem1, oSay:Refresh(), .t. )

Best Regards
Uwe :)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Tooltip in a combo box?

Postby hag » Thu Oct 21, 2010 10:23 pm

As usual you've been very helpful. The problem I have is on change a number of functions need to run. So I added the code you suggested it ran the functions as needed. Is there a way to put in the tool tip when the item is highlighted or moused over rather on change.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Tooltip in a combo box?

Postby elvira » Thu Jul 24, 2014 1:19 pm

Hello,

I modified samples\testcomb.prg but I can´t get the tooltips.

Please, can you help me?

Code: Select all  Expand view
// This sample shows how to create a Combo Test.

#include "FiveWin.ch"


//----------------------------------------------------------------------------//

function Main()

   local oDlg, oCbx, oSayItem, oSayAt
   local cItem := "this"

   SET _3DLOOK ON

   DEFINE DIALOg oDlg RESOURCE "TestCombo"

   REDEFINE COMBOBOX oCbx VAR cItem ITEMS { "Testing", "this", "ComboBox" } ;
      ID 110 OF oDlg ;
      ON CHANGE ( oCbx:oGet:cTooltip := "Elvira ", oCbx:ShowTooltip(), oSayItem:cTitle := cItem , ;
IIF( oCbx:nAt = 1, oCbx:oGet:cTooltip := "Tooltip Row-position 1", oCbx:oGet:cTooltip := "other" ), ;
IIF( oCbx:nAt = 2, oCbx:oGet:cTooltip := "Tooltip Row-position 2", NIL ), ;
IIF( oCbx:nAt = 3, MsgWait( "Message-Test 3", "Row Position 3", 2 ), NIL ) ) ;
VALID ( MsgBeep(), .t. )






/*
      ON CHANGE ( oSayItem:cTitle := cItem,;   // We should use also :SetText()
                  oSayAt:cTitle   := ":nAt = " + Str( oCbx:nAt, 2 ) ) ;
      VALID ( MsgBeep(), .t. )
*/



   REDEFINE SAY oSayItem ID 120 OF oDlg

   REDEFINE BUTTON ID 130 OF oDlg ACTION oCbx:Reset()

   REDEFINE BUTTON ID 140 OF oDlg ;
      ACTION oCbx:SetItems( { "Let's", "Set", "a new", "List" } )

   REDEFINE BUTTON ID 220 OF oDlg ACTION MsgInfo( Str( oCbx:nAt ) )

   REDEFINE SAY oSayAt ID 150 OF oDlg

   ACTIVATE DIALOG oDlg CENTERED ;
    on init oCbx:oGet:cTooltip := "Init tooltip"

return nil

//----------------------------------------------------------------------------//
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: Tooltip in a combo box?

Postby elvira » Sun Aug 10, 2014 10:49 am

Up
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: Tooltip in a combo box?

Postby vilian » Wed May 31, 2017 9:43 pm

+1
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Tooltip in a combo box?

Postby ariston.ap » Wed May 31, 2017 11:12 pm

Try this:
Code: Select all  Expand view

oCbx:cToolTip := {|cTip|cTip:=oCbxToolTip(oCbx)}

//---------------------------------------------------------------------------//
FUNCTION oCbxToolTip(oCbx)
RETURN oCbx:GetText()
//----------------------------------------------------------------------------//
 
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
FWH1206 / XHB121 / BCC582 / RESOURCE WORKSHOP / XDEVSTUDIO
Please visit: arsoft-ap.com
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
User avatar
ariston.ap
 
Posts: 11
Joined: Mon Jun 29, 2015 8:16 pm
Location: Macapá - AP - Brazil

Re: Tooltip in a combo box?

Postby vilian » Thu Jun 01, 2017 2:10 am

Ariston,
Thank you for try help, but don't work. I want the same of Elvira wrote bellow:

hag wrote:As usual you've been very helpful. The problem I have is on change a number of functions need to run. So I added the code you suggested it ran the functions as needed. Is there a way to put in the tool tip when the item is highlighted or moused over rather on change.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 127 guests