Focal Point
[SOLVED] Tool-Tip Styling

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7367064196

August 08, 2019, 02:04 PM
getit
[SOLVED] Tool-Tip Styling
How do we style this tool-tip?

 

-SET &ECHO=ALL;
SET PAGE-NUM = NOPAGE
-SET &FIRST_CURR_MONTH = EDIT(&YYMD, '9999$$$$')  || '/'  || EDIT(&YYMD, '$$$$99$$')  || '/' || '01';

-RUN

-*Get first day of current month
-SET &FIRSTD = EDIT(&YYMD, '999999$$') || '01';
-*Get first day of rolling last 12 month
-SET &FIRSTDLM = DATECVT(DATEADD(DATECVT(&FIRSTD, 'I8YYMD', 'YYMD'), 'M', -13), 'YYMD', 'A8YYMD');
-SET &FIRST_LAST_MONTH = EDIT(&FIRSTDLM, '9999$$$$')  || '/'  || EDIT(&FIRSTDLM, '$$$$99$$')  || '/' || '01';

-RUN

-SET &TITLE_MSG = '<span style="cursor: default;" ' | 'title="Retail Cost minus Dealer Cost">Profit</span>';

DEFINE FILE CAR
PROFIT/D7          = RETAIL_COST - DEALER_COST;
T1_PROFIT/A12      = FPRINT(PROFIT, 'D7', 'A12');
T1_RETAIL_COST/A12 = FPRINT(RETAIL_COST, 'D7', 'A12');
T1_DEALER_COST/A12 = FPRINT(DEALER_COST, 'D7', 'A12');
MO_PROFIT/A255 =
   '<span style="cursor: default;" title="'
|| 'From:' || (' ' | '&FIRST_LAST_MONTH.EVAL')
|| ( ' ' | '&|#013;'
|| 'To: ' || (' ' | '&FIRST_CURR_MONTH')
|| '">') || T1_PROFIT || '</span>';
END
-RUN

TABLE FILE CAR
PRINT
MO_PROFIT AS '&TITLE_MSG'

WHERE RECORDLIMIT EQ 1
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=MO_PROFIT, JUSTIFY=RIGHT, $
ENDSTYLE
END
-RUN


 

This message has been edited. Last edited by: FP Mod Chuck,


App Studio Version 8202
windows Platform
SQL Server 2008/2012
August 08, 2019, 02:54 PM
Hallway

The code that you posted is incomplete because it includes html tags in it, and the browser tried to render that html.

When posting code on the forums, please click on the     in the tool bar to block out your code.




Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
August 08, 2019, 03:10 PM
getit
I edited the message. That is pretty much it. Thanks.


App Studio Version 8202
windows Platform
SQL Server 2008/2012
August 08, 2019, 04:36 PM
Hallway
Excellent. Thank you. That completed the missing pieces. You can use css to do something like this:
 
 SET PAGE-NUM = NOPAGE
-SET &FIRST_CURR_MONTH = EDIT(&YYMD, '9999$$$$')  || '/'  || EDIT(&YYMD, '$$$$99$$')  || '/' || '01';
-RUN

-*Get first day of current month
-SET &FIRSTD = EDIT(&YYMD, '999999$$') || '01';
-*Get first day of rolling last 12 month
-SET &FIRSTDLM = DATECVT(DATEADD(DATECVT(&FIRSTD, 'I8YYMD', 'YYMD'), 'M', -13), 'YYMD', 'A8YYMD');
-SET &FIRST_LAST_MONTH = EDIT(&FIRSTDLM, '9999$$$$')  || '/'  || EDIT(&FIRSTDLM, '$$$$99$$')  || '/' || '01';

-RUN

-* -SET &TITLE_MSG = '<span style="cursor: default;" ' | 'title="Retail Cost minus Dealer Cost">Profit</span>';
-SET &TITLE_MSG = '<div class="tooltip">Profit<span class="tooltiptext">Retail Cost minus Dealer Cost</span>';

DEFINE FILE CAR
PROFIT/D7          = RETAIL_COST - DEALER_COST;
T1_PROFIT/A12      = FPRINT(PROFIT, 'D7', 'A12');
T1_RETAIL_COST/A12 = FPRINT(RETAIL_COST, 'D7', 'A12');
T1_DEALER_COST/A12 = FPRINT(DEALER_COST, 'D7', 'A12');
MO_PROFIT/A255 = '<div class="tooltip">' || T1_PROFIT || '<span class="tooltiptext">From: &FIRST_LAST_MONTH.EVAL<br>To: &FIRST_CURR_MONTH.EVAL</span></div>';
END
-RUN

TABLE FILE CAR
PRINT
MO_PROFIT AS '&TITLE_MSG'
WHERE RECORDLIMIT EQ 1
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=MO_PROFIT, JUSTIFY=RIGHT, $
ENDSTYLE
END
-RUN

-HTMLFORM BEGIN NOEVAL
<style>
    /* Tooltip container */
    .tooltip {
        position: relative;
        display: inline-block;
        border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
    }

    /* Tooltip text */
    .tooltip .tooltiptext {
        visibility: hidden;
        width: 150px;
        background-color: #555;
        color: #fff;
        text-align: center;
        padding: 5px 0;
        border-radius: 6px;

    /* Position the tooltip text */
        position: absolute;
        z-index: 1;
        top: -15px;
        left: calc(100% + 10px); 

    /* Fade in tooltip */
        opacity: 0;
        transition: opacity 0.3s;
    }

    /* Tooltip arrow */
    .tooltip .tooltiptext::after {
        content: '';
        position: absolute;
        top: 50%;
        right: 100%; /* To the left of the tooltip */
        margin-top: -5px;
        border-width: 5px;
        border-style: solid;
        border-color: transparent #555 transparent transparent;
    }

    /* Show the tooltip text when you mouse over the tooltip container */
    .tooltip:hover .tooltiptext {
        visibility: visible;
        opacity: 1;
    }
</style>
-HTMLFORM END


Read more about this here: https://www.w3schools.com/css/css_tooltip.asp

This message has been edited. Last edited by: Hallway,


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
August 08, 2019, 04:42 PM
Hallway
I edited the code above. I missed the &TITLE_MSG


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
August 08, 2019, 04:51 PM
MReeder
You cannot style using "title" you will have to use "data-title". I found this code while searching the internet (google) and stackoverflow.com had this solution.

You will also ahve to use CSS styling:
 

-* File: IBFS:/DEV-WebFocusAT/WFC/Repository/Test/Marita/Procedure2.fex Created by WebFOCUS AppStudio
-SET &ECHO=ALL;
SET PAGE-NUM = NOPAGE
-SET &FIRST_CURR_MONTH = EDIT(&YYMD, '9999$$$$')  || '/'  || EDIT(&YYMD, '$$$$99$$')  || '/' || '01';

-RUN

-*Get first day of current month
-SET &FIRSTD = EDIT(&YYMD, '999999$$') || '01';
-*Get first day of rolling last 12 month
-SET &FIRSTDLM = DATECVT(DATEADD(DATECVT(&FIRSTD, 'I8YYMD', 'YYMD'), 'M', -13), 'YYMD', 'A8YYMD');
-SET &FIRST_LAST_MONTH = EDIT(&FIRSTDLM, '9999$$$$')  || '/'  || EDIT(&FIRSTDLM, '$$$$99$$')  || '/' || '01';

-RUN

-SET &TITLE_MSG = '<span style="cursor: default;" ' | 'title="Retail Cost minus Dealer Cost">Profit</span>';

DEFINE FILE CAR
PROFIT/D7          = RETAIL_COST - DEALER_COST;
T1_PROFIT/A12      = FPRINT(PROFIT, 'D7', 'A12');
T1_RETAIL_COST/A12 = FPRINT(RETAIL_COST, 'D7', 'A12');
T1_DEALER_COST/A12 = FPRINT(DEALER_COST, 'D7', 'A12');
MO_PROFIT/A255 =
   '<span style="cursor: default;color=red;"  data-title="'
|| 'From:' || (' ' | '&FIRST_LAST_MONTH.EVAL')
|| ( ' ' | '&|#013;'
|| 'To: ' || (' ' | '&FIRST_CURR_MONTH')
|| '">') || T1_PROFIT || '</span>';
END
-RUN

TABLE FILE CAR
PRINT
MO_PROFIT AS '&TITLE_MSG'

WHERE RECORDLIMIT EQ 1
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=MO_PROFIT, JUSTIFY=RIGHT, $
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN
<style>

[data-title]:hover:after {
    opacity: 1;
    transition: all 0.1s ease 0.5s;
    visibility: visible;
}
[data-title]:after {
    content: attr(data-title);
    background-color: #00FF00;
    color: #111;
    font-size: 150%;
    position: absolute;
    padding: 1px 5px 2px 5px;
    bottom: -1.6em;
    left: 100%;
    white-space: nowrap;
    box-shadow: 1px 1px 3px #222222;
    opacity: 0;
    border: 1px solid #111111;
    z-index: 99999;
    visibility: hidden;
}
[data-title] {
    position: relative;
}
</style>

-HTMLFORM END

 



WebFOCUS 8.2.02M
Windows
Server/8.2.02M
All Outputs
August 08, 2019, 05:56 PM
Hallway
There is always the option of integrating Bootstrap 4 into your report output as well and user their tooltip set up (Read more here: https://getbootstrap.com/docs/...components/tooltips/

This code uses the bootstrap tooltips which uses the title attribute of the element:
  
SET PAGE-NUM = NOPAGE
-SET &FIRST_CURR_MONTH = EDIT(&YYMD, '9999$$$$')  || '/'  || EDIT(&YYMD, '$$$$99$$')  || '/' || '01';
-RUN

-*Get first day of current month
-SET &FIRSTD = EDIT(&YYMD, '999999$$') || '01';
-*Get first day of rolling last 12 month
-SET &FIRSTDLM = DATECVT(DATEADD(DATECVT(&FIRSTD, 'I8YYMD', 'YYMD'), 'M', -13), 'YYMD', 'A8YYMD');
-SET &FIRST_LAST_MONTH = EDIT(&FIRSTDLM, '9999$$$$')  || '/'  || EDIT(&FIRSTDLM, '$$$$99$$')  || '/' || '01';

-RUN

-SET &TITLE_MSG = '<span data-toggle="tooltip" data-placement="top" data-container="body" title="Retail Cost minus Dealer Cost">Profit</span>';

DEFINE FILE CAR
PROFIT/D7          = RETAIL_COST - DEALER_COST;
T1_PROFIT/A12      = FPRINT(PROFIT, 'D7', 'A12');
T1_RETAIL_COST/A12 = FPRINT(RETAIL_COST, 'D7', 'A12');
T1_DEALER_COST/A12 = FPRINT(DEALER_COST, 'D7', 'A12');
MO_PROFIT/A255 = '<span data-toggle="tooltip" data-placement="right" data-container="body" data-html="true" title="From: &FIRST_LAST_MONTH.EVAL<br>To: &FIRST_CURR_MONTH.EVAL">' || T1_PROFIT || '</span>';
END
-RUN

TABLE FILE CAR
PRINT
MO_PROFIT AS '&TITLE_MSG'
WHERE RECORDLIMIT EQ 1
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=MO_PROFIT, JUSTIFY=RIGHT, $
ENDSTYLE
END
-RUN

-HTMLFORM BEGIN NOEVAL
<head>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.bundle.min.js'></script>
<script>
    $(function () {
        $('[data-toggle="tooltip"]').tooltip();
    })
</script>
<head>
-HTMLFORM END



Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
August 12, 2019, 03:03 PM
getit
These suggestions work.Thank you.


App Studio Version 8202
windows Platform
SQL Server 2008/2012
August 12, 2019, 05:17 PM
Hallway
Excellent!!

🎉

Don't forget to change the title of the post to start with [SOLVED]

This message has been edited. Last edited by: Hallway,


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs: