Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Jan 29, 2020 10:29 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Tooltip with OverlayMBS
PostPosted: Wed Feb 02, 2011 7:30 am 
Offline

Joined: Sun Apr 11, 2010 4:33 am
Posts: 102
Hi,
guys how can create a tooltip like this with OverlayMBS?

Image

I write this, but i don't now how add the arrow and the close button, can you help me?

Sub CreateToolTip(wBox as integer, hBox as integer, b as Boolean)
Dim hRect, wRect, lButton, tButton as integer
wRect = wBox-200
hRect = hBox-30
lButton = (toolWin.popupFormati.frameLeft-toolWin.popupFormati.frameWidth)
tButton = (toolWin.popupFormati.frametop+toolWin.popupFormati.frameHeight)*1.7

pTT = new Picture(wBox,hBox,32)
mTT = new Picture(wBox,hBox,32)
oTT = new toolTipLocalita(lButton,tButton,wBox,hBox,b)
oTT.Pict = pTT
oTT.Mask = mTT
oTT.Show
TimerOverlay.Mode=2
dim pg as Graphics = oTT.Pict.Graphics
dim mg as Graphics = oTT.Mask.Graphics
pg.ForeColor=&c000000
pg.FillRoundRect 190,10,wRect,hRect,50,50
pg.ForeColor=&c000000
dim stp as StyledTextPrinter
stp = txtToolTip.StyledTextPrinter(pg,wRect-20)
stp.DrawBlock wBox-wRect,30,hRect-20
mg.ForeColor=&c333333
mg.FillRoundRect 190,10,wRect,hRect,50,50
End Sub


Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: Tooltip with OverlayMBS
PostPosted: Wed Feb 02, 2011 8:07 am 
Offline

Joined: Mon Jul 24, 2006 4:06 am
Posts: 274
Hi,

I'm working on this issue, too. The nose is next on my to-do-list.

Have a look at the example My first easy OverlayMBS. This has several nice helper functions. It has, for instance, a function to draw a path. Let's have some pseudo code for the nose on the upper side:

- ScreenY is set to 0 for simplicity.
- The original upper line is from ScreenX , 0 to ScreenX + TooltipWidth, 0. This line needs to be changed.
- Instead draw a line from ScreenX, 0 to ScreenX + (TooltipWidth/2) - NoseWidth/2, 0 (base of the nose).
- Now draw from this point to ScreenX + (TooltipWidth/2), - NoseHeight (tip of the nose).
- And then to ScreenX + (TooltipWidth/2) + NoseWidth/2 (second base of nose).
- Finally draw the rest of the base path.

I hope this is clear enough. Most likely, I will not finish my code in the next week. But you can also post your question on the MBS mailing list, if you have more questions.

HTH

Trixi

_________________
Mit freundlichen Grüßen/Regards

Trixi Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals


Top
 Profile  
Reply with quote  
 Post subject: Re: Tooltip with OverlayMBS
PostPosted: Wed Feb 02, 2011 11:38 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
You prepare a few pictures:

* one for the bubble.
* several for the possible triangle directions
* and a picture for the close button.

Now you make a window big enough to cover everything. You calculate the margin and draw your bubble inside (mask and picture).
On the side you want the triangle (arrow), you draw it over the bubble edge (mask and picture).
And for the Close button, you simply draw it over the area (mask and picture)

It may be a little different on the mask math to get the mask merge the right way.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Tooltip with OverlayMBS
PostPosted: Wed Feb 02, 2011 6:42 pm 
Offline

Joined: Mon Nov 03, 2008 6:36 am
Posts: 477
Location: Italia > Milano > Solaro
matt86 wrote:
Hi,
guys how can create a tooltip like this with OverlayMBS?

Image

I write this, but i don't now how add the arrow and the close button, can you help me?

Sub CreateToolTip(wBox as integer, hBox as integer, b as Boolean)
Dim hRect, wRect, lButton, tButton as integer
wRect = wBox-200
hRect = hBox-30
lButton = (toolWin.popupFormati.frameLeft-toolWin.popupFormati.frameWidth)
tButton = (toolWin.popupFormati.frametop+toolWin.popupFormati.frameHeight)*1.7

pTT = new Picture(wBox,hBox,32)
mTT = new Picture(wBox,hBox,32)
oTT = new toolTipLocalita(lButton,tButton,wBox,hBox,b)
oTT.Pict = pTT
oTT.Mask = mTT
oTT.Show
TimerOverlay.Mode=2
dim pg as Graphics = oTT.Pict.Graphics
dim mg as Graphics = oTT.Mask.Graphics
pg.ForeColor=&c000000
pg.FillRoundRect 190,10,wRect,hRect,50,50
pg.ForeColor=&c000000
dim stp as StyledTextPrinter
stp = txtToolTip.StyledTextPrinter(pg,wRect-20)
stp.DrawBlock wBox-wRect,30,hRect-20
mg.ForeColor=&c333333
mg.FillRoundRect 190,10,wRect,hRect,50,50
End Sub


Thanks


examples RoundRect trasparent 90% use gray scale 0-100

Sub CreateToolTip(g as Graphics)

dim p,pmask as Picture

p = newPicture(300,100,32)
pmask = newPicture(300,100,32)

// mask trasparent
pmask.Graphics.ForeColor = &cE5E5E5 // 90% gray color
pmask.Graphics.FillRoundRect 0,0,pmask.Width,pmask.Height,12,12

// image
p.Graphics.ForeColor = &c3B6CA9// blue color
p.Graphics.FillRoundRect 0,0,pmask.Width,pmask.Height,12,12
p.Mask.Graphics.DrawPicture pmask,0,0

g.DrawPicture p,0,0

g.DrawRoundRect 0,0,pmask.Width,pmask.Height,12,12

if Oval = true then
g.DrawOval 250,20,30,30
end if
End Sub

examples icon close 16x16 - left = 40 top = 22

Function MouseDown(X As Integer, Y As Integer) As Boolean
return True
End Function


Sub MouseDrag(X As Integer, Y As Integer)
if (x > 40 and x< 40+16) and (y>22 and y < 22+16) then
self.close
end if
End Sub

or into mouseUp

Sub MouseUp(X As Integer, Y As Integer)
if (x > 40 and x< 40+16) and (y>22 and y < 22+16) then
self.close
end if
End Sub

I For the design target you draw it with Photoshop and then use mbs, hope I have understood your request :-)

_________________
REALStudio
Custom controls and classes for RealStudio ( no plugin )
http://www.ivanomonti.eu


Top
 Profile  
Reply with quote  
 Post subject: Re: Tooltip with OverlayMBS
PostPosted: Fri Feb 04, 2011 6:19 am 
Offline

Joined: Sun Apr 11, 2010 4:33 am
Posts: 102
Thanks guys!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group