FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Tooltip in a combo box?
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Tooltip in a combo box?
Posted: Thu Oct 21, 2010 02: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 (fw): Select all Collapse
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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Tooltip in a combo box?
Posted: Thu Oct 21, 2010 04:06 PM

Harvey,

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

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Re: Tooltip in a combo box?
Posted: Thu Oct 21, 2010 04:52 PM

Thanks James.

Thank you

Harvey
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Tooltip in a combo box?
Posted: Thu Oct 21, 2010 06:38 PM
Harvey,

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



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:cTooltip := "Tooltip Row-position 1", NIL ), ;
IIF( oCbx1:nAt = 2, oCbx1:cTooltip := "Tooltip Row-position 2", NIL ), ;
IIF( oCbx1:nAt = 3, oCbx1: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.



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.
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Re: Tooltip in a combo box?
Posted: 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
Posts: 518
Joined: Fri Jun 29, 2012 12:49 PM
Re: Tooltip in a combo box?
Posted: Thu Jul 24, 2014 01:19 PM
Hello,

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

Please, can you help me?

Code (fw): Select all Collapse
// 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

//----------------------------------------------------------------------------//
Posts: 518
Joined: Fri Jun 29, 2012 12:49 PM
Re: Tooltip in a combo box?
Posted: Sun Aug 10, 2014 10:49 AM

Up

Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Tooltip in a combo box?
Posted: Wed May 31, 2017 09:43 PM

+1

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 11
Joined: Mon Jun 29, 2015 08:16 PM
Re: Tooltip in a combo box?
Posted: Wed May 31, 2017 11:12 PM
Try this:
Code (fw): Select all Collapse
oCbx:cToolTip := {|cTip|cTip:=oCbxToolTip(oCbx)}

//---------------------------------------------------------------------------//
FUNCTION oCbxToolTip(oCbx)
RETURN oCbx:GetText()
//----------------------------------------------------------------------------//
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]

FWH1206 / XHB121 / BCC582 / RESOURCE WORKSHOP / XDEVSTUDIO

Please visit: arsoft-ap.com

[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Tooltip in a combo box?
Posted: Thu Jun 01, 2017 02: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

Continue the discussion