IonicWind Software

IWBasic => GUI Central => Topic started by: paja on June 16, 2011, 03:14:05 AM

Title: Windows balloon tips ?
Post by: paja on June 16, 2011, 03:14:05 AM
Hi,

Please does anybody know how can I show balloon tips anywhere on the screen?

Can I put into it any image ?

Thanks
Title: Re: Windows baloon tips ?
Post by: LarryMc on June 16, 2011, 10:06:28 AM
The tooltips section of the ControlPak help file shows you how to create balloon tooltips.

LarryMc
Title: Re: Windows baloon tips ?
Post by: paja on June 16, 2011, 10:14:18 AM
I red it. But I need place balloon tooltips anywhere - not only at control with id.

Paja
Title: Re: Windows baloon tips ?
Post by: LarryMc on June 16, 2011, 10:50:00 AM
tooltips are tied to control ids.

It sounds like you need to make a subroutine that creates a round window that is display at the current mouse coordinates.

I think that is going to be a totally 'build your own' type of thing.

LarryMc
Title: Re: Windows baloon tips ?
Post by: GWS on June 16, 2011, 11:12:10 AM
Here's one 'build your own' method.

Maybe it could go in a subroutine with some devious logic to place the 'balloon' anywhere ..  ;D


def w:window
def wstyle,i,textW,textH:int
def a$:string

wstyle = @minbox

' open a window ..
openwindow w,0,0,600,400,wstyle,0,"Creative Basic",&messages
setwindowcolor w,rgb(0,0,30)
centerwindow w

control w,@button,"Exit",(600-70)/2,310,70,30,0,1

a$ = "A Message for you"

' show the message ...
drawmode w,@transparent
frontpen w, RGB(10,10,10)
SETFONT w, "Times New Roman",9,400
GETTEXTSIZE w, a$, textW, textH
ELLIPSE w, 220, 100, textW+50, 80 , rgb(220,220,180),rgb(220,220,180)
line w,245,200,260,160,rgb(220,220,180)
line w,245,200,280,160,rgb(220,220,180)
FLOODFILL w,255,185,rgb(220,220,180)
move w,245,130
PRINT w,a$

run = 1

WAITUNTIL run = 0
CLOSEWINDOW w
END

SUB messages
select @class
case @idclosewindow
run = 0
case @idcontrol
if @controlID = 1 then run = 0
endselect
RETURN
endsub



A bit crude, but it works OK ..

all the best, :)

Graham

Title: Re: Windows baloon tips ?
Post by: LarryMc on June 16, 2011, 11:32:56 AM
Graham,
That's exactly the sort of code I was talking about. :)

LarryMc
Title: Re: Windows balloon tips ?
Post by: paja on June 16, 2011, 06:27:10 PM
Thanks,

It is one way. But I would like to add balloon tips like control - it means simple to add and simple to remove and balloon tips musts go over control too.

Paja
Title: Re: Windows balloon tips ?
Post by: LarryMc on June 16, 2011, 07:17:55 PM
Quote from: paja on June 16, 2011, 06:27:10 PM
Thanks,

It is one way. But I would like to add balloon tips like control - it means simple to add and simple to remove and balloon tips musts go over control too.

Paja

I understand. And I want to be a billionaires only son. ;D

Answer me some questions.
How do you plan to make one of these balloons appear? disappear?
How are you going to distinguish which text applies to which pixel on the screen (since you aren't using standard tooltips)?

Answer these questions and maybe someone can better help you.
A quick glance at the Windows SDK indicates you can have tracking tooltips that you can control when and where they appear.  But that section is in  a different place than the discussion about balloon tooltips.

LarryMc
Title: Re: Windows balloon tips ?
Post by: paja on June 17, 2011, 02:54:03 AM
I wanted to use balloon tips for warning and info messages for users in control system. Thus I need place it anywhere.
Title: Re: Windows balloon tips ?
Post by: GWS on June 17, 2011, 06:02:40 AM
Still not sure what you're after Paja ..

Maybe you mean small pop-up dialog boxes containing a message which appear over a GUI control panel. But what initiates them ?

Or maybe you want messages activated by the mouse hovering over controls, like tooltips? - but not actual tooltips.

It's so difficult to communicate ideas in a few words.

best wishes, :)

Graham
Title: Re: Windows balloon tips ?
Post by: aurelCB on June 17, 2011, 06:45:32 AM
I dont see what is problem here ???
small example:
'test ToolTip
DEF w1:WINDOW
REM open the window
OPENWINDOW w1,0,0,600,400,@MINBOX,0,"Simple Window",&main
REM print a message
SETWINDOWCOLOR w1,RGB(220,220,230)
'----------------------------------------------------------
CONTROL w1,@SYSBUTTON,"Button1",10,18,94,38,0x50000000,1

CONTROL w1,@EDIT,"Edit1",121,20,370,174,0x50B010C4,2

'create the tool tip control
hTooltip = ToolTipControl(w1,@TTS_ALWAYSTIP|@TTS_BALLOON,0)
'add tooltips for our buttons
ttAddTool hTooltip,@TTF_SUBCLASS|@TTF_IDISHWND,GetControlHandle(w1,1),hTooltip,"Button number one"
ttAddTool hTooltip,@TTF_SUBCLASS|@TTF_IDISHWND,GetControlHandle(w1,2),hTooltip,"Type your text here!"





WAITUNTIL w1 = 0
END
'---
REM every time there is a message for our window

SUB main
'IF @hitwindow=*<window>pw
IF @message= @IDCREATE
CENTERWINDOW #<WINDOW>@HITWINDOW
ENDIF


IF @Message = @IDCLOSEWINDOW
        CLOSEWINDOW w1
'IF *<window>pw2<>0 THEN CLOSEWINDOW *<window>pw2
ENDIF
'ENDIF
RETURN
ENDSUB




You can also read this article:
http://www.codeproject.com/KB/miscctrl/ballontooltip.aspx?msg=2753065
Title: Re: Windows balloon tips ?
Post by: paja on June 17, 2011, 08:10:55 AM
Hi,

Nice - OK. But as I wrote I need show balloon tips anywhere according program request - not only on mouse over.

Paja
Title: Re: Windows balloon tips ?
Post by: billhsln on June 17, 2011, 08:45:14 AM
Sounds more like you want to put out a MESSAGEBOX on program errors.

Bill
Title: Re: Windows balloon tips ?
Post by: paja on June 17, 2011, 09:03:21 AM
No message box. Balloon tip can show on real place what I want. I need write any messages into balloon tip.
Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 09:15:54 AM
Again,
QuoteHow do you plan to make one of these balloons appear? disappear?
How are you going to distinguish which text applies to which pixel on the screen (since you aren't using standard tooltips)?

Answer these questions and maybe someone can better help you.

LarryMc
Title: Re: Windows balloon tips ?
Post by: aurelCB on June 17, 2011, 09:21:51 AM
QuoteNice - OK. But as I wrote I need show balloon tips anywhere according program request - not only on mouse over.

Larry is right...
How you mean ,i mean by which trigger you mean to open ballon tip on any place
of screen - not window ???
I dont see any kind of program that can do that...
Title: Re: Windows balloon tips ?
Post by: aurelCB on June 17, 2011, 09:26:59 AM
Or maby you mean on something like 'sticky note' -which is infact nocaption
dragable window....
Title: Re: Windows balloon tips ?
Post by: paja on June 17, 2011, 09:39:38 AM
I use RGNBUTTONs like devices on the screen in control process program and I would like use balloon tips to inform user about devices status according program request.
Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 09:45:55 AM
Maybe we're getting somewhere.

You say RGNBUTTON like devices.  Do they have a windows handle?
LarryMc
Title: Re: Windows balloon tips ?
Post by: GWS on June 17, 2011, 09:55:10 AM
I think we may have been here before ..  ::)

http://www.ionicwind.com/forums/index.php?topic=3622.0 (http://www.ionicwind.com/forums/index.php?topic=3622.0)

A bit of example code, or more explanation is probably needed.

all the best, :)

Graham
Title: Re: Windows balloon tips ?
Post by: paja on June 17, 2011, 10:16:35 AM
I have control program for some devices. RGNBUTTON is like picture of device shown on the screen (window). Thus my program is used for move devices in the area and on the screen I see some parameters for example positions. And sometimes I would like to  show balloon tip for this RGNBUTTON with more info about devices. But without "mouse over" function.


Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 10:29:23 AM
Okay.
How do you determine when to show balloon and not show balloon since you don't want to use mouseover?
Do these 'images' always appear in the same spots on the screen?

LarryMc
Title: Re: Windows balloon tips ?
Post by: paja on June 17, 2011, 10:46:11 AM
For move devices is used the joystick. The communication with devices is over RS485 bus - both ways direction. For example - when devices has some error I would like to see it in balloon tip.
Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 11:02:14 AM
How it communicates has nothing to do with the problem.

Is the following correct:
1. You have an image on the screen that is not associated to any control handle.
2. You move a joy stick and the image on the screen moves.
3. If the external object has a problem you want a balloon to appear on the associated image on the screen (where ever the image may currently be on the screen).

Again, are the 3 statements 100% correct?

If so, does the balloon stay until the error goes away or,
Does it go away when the user acknowledges the error?

Can you provide a screenshot?

LarryMc
Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 11:17:13 AM
30 years ago we did the following for devices controlled from a screen.
All the images(symbols for equipment) on the screen had fixed locations.
We used multiple pages to show more devices than what would fit on one screen.
All the symbols used 3 different colors that defined the devices current state.

At the bottom of all pages was a 3 line scrolling listbox.
When devices alarmed(had an error) a new line was added to the top of the listbox and was made to flash.
When the alarm was acknowledged the line would still be there if it was still in an alarm state.
If it was no longer in the alarm state the line would disappear, if it had been acknowledged.

The whole idea was that there was no way the User could miss something that had happened because they were on phone, bathroom, etc.

That system had 10,000 devices attached and almost 200 pages(screens)

LarryMc
Title: Re: Windows balloon tips ?
Post by: paja on June 17, 2011, 11:19:49 AM
Here is screenshot of status I want - device with balloon tip.

Devices are like RNGBUTTONs. Device are offline and thus there are "?" instead of real x/y positions.
In the balloon tips I would like to show some more info about devices (erros for examples) connected over RS485 bus.
If will be for example error(s) then balloon tip will be show until error(s) will be out.






Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 11:39:25 AM
Okay, I'll ask one more time.
Are the yellow boxes in a fixed position on the screen?
How are the yellow boxes drawn ( and don't say like a RGNBUTTON)
   Are they images put there with the showimage command?
   Are they drawn with RECT command?
   Are they bitmaps in a STATIC control?

If you can't answer our simple questions I'm going to have to give up on trying to help you.

LarryMc
Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 03:25:04 PM
Just playing around before I go back to my help file chore.
I ripped off someones code and played with it until I got this.
Compile as a window.
It creates 10 tooltips for the main window; no controls.
Each tooltip appears in a different location.
They only appear when the mouse is in the client area.
If you click in the window they all disappear until the mouse moves out of the client area and then back.

I set up a timer to show/hide tooltips when I want to.

So:
tooltips without controls - check
multiple tooltips showing at one time - check
application control of were tooltips appear - check
application control of when tooltips appear - check

beep- making it so clicking on the window does not hide the tooltips.
But I think I'm done.
$INCLUDE "WindowsSDK.inc"
$INCLUDE "CommCtrl.inc"
INT WinOldProc
UINT hwndTooltip[10]
int px[10]
int py[10]
px[0]=5,35,65,95,125,155,185,215,245,275
py[0]=5,35,65,95,125,155,185,215,245,275
int z=0
WINDOW w1
OPENWINDOW w1,0,0,512,347,0x80C80080,0,"Tooltip",&w1_handler
Init()
starttimer w1,1000
WAITUNTIL w1=0
end

SUB w1_handler
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW w1
CASE @IDCLOSEWINDOW
SetWindowLong(w1.hwnd, GWL_WNDPROC, WinOldProc)
CLOSEWINDOW w1
CASE @IDCONTROL
case @idtimer
z++:if z>9 then z=0
select z
case 0
SENDMESSAGE hwndTooltip[0],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[7],TTM_ACTIVATE,0,0
case 1
SENDMESSAGE hwndTooltip[6],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[1],TTM_ACTIVATE,0,0
case 2
SENDMESSAGE hwndTooltip[1],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[3],TTM_ACTIVATE,0,0
case 3
SENDMESSAGE hwndTooltip[8],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[0],TTM_ACTIVATE,0,0
case 4
SENDMESSAGE hwndTooltip[3],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[2],TTM_ACTIVATE,0,0
case 5
SENDMESSAGE hwndTooltip[9],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[6],TTM_ACTIVATE,0,0
case 6
SENDMESSAGE hwndTooltip[5],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[8],TTM_ACTIVATE,0,0
case 7
SENDMESSAGE hwndTooltip[2],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[4],TTM_ACTIVATE,0,0
case 8
SENDMESSAGE hwndTooltip[7],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[9],TTM_ACTIVATE,0,0
case 9
SENDMESSAGE hwndTooltip[4],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[5],TTM_ACTIVATE,0,0
endselect
    ENDSELECT
RETURN
ENDSUB

SUB MainProc(INT hWin, INT uMsg, INT wParam, INT lParam), INT
pointer pnmhdr : SETTYPE pnmhdr, NMHDR
SELECT uMsg
CASE WM_NOTIFY
pnmhdr = *<NMHDR> lParam
RETURN OnNotify(hWin, #pnmhdr.idFrom, #pnmhdr.code, #pnmhdr.hwndFrom, lParam)
ENDSELECT
RETURN CallWindowProc(WinOldProc, hWin, uMsg, wParam, lParam)
ENDSUB

SUB OnNotify(int hWin, int ctrlid, int code, int hwndCtrl, int lParam), INT
WINRECT rc
POINT pnt

int x
for x=0 to 9
if hwndCtrl = hwndTooltip[x] then breakfor
next x

if x>9 then return 0
SELECT code
CASE TTN_SHOW
GetClientRect(hWin, &rc)
pnt.x = rc.right
pnt.y = rc.bottom
ClientToScreen(hWin, &pnt)
MoveWindow(hwndTooltip[x], px[x]+pnt.x-rc.right, py[x]+pnt.y-rc.bottom, 200, 200, 0)
'MoveWindow(hwndTooltip[x], pa[x].x+pnt.x-200, pa[x].y +pnt.y-200, 200, 200, 0)  
RETURN 1
ENDSELECT

    RETURN 0
ENDSUB

SUB Init()
for x= 0 to 9
hwndTooltip[x] = ToolTipControl(w1, @TTS_ALWAYSTIP|@TTS_BALLOON, 0)
SENDMESSAGE hwndTooltip[x],TTM_SETDELAYTIME,TTDT_INITIAL,0
SENDMESSAGE hwndTooltip[x],TTM_ACTIVATE,0,0
ttAddTool hwndTooltip[x],@TTF_SUBCLASS|@TTF_IDISHWND,w1.hwnd,w1.hwnd,"Black"+str$(x)
next x
   WinOldProc = SetWindowLong(w1.hwnd, GWL_WNDPROC, &MainProc)
ENDSUB


LarryMc
Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 03:43:03 PM
Added some color - the balloons change colors each cycle
$INCLUDE "WindowsSDK.inc"
$INCLUDE "CommCtrl.inc"
INT WinOldProc
UINT hwndTooltip[10]
int px[10]
int py[10]
px[0]=5,35,65,95,125,155,185,215,245,275
py[0]=5,35,65,95,125,155,185,215,245,275
int z=0,y=0
WINDOW w1
OPENWINDOW w1,0,0,512,347,0x80C80080,0,"Tooltip",&w1_handler
Init()
starttimer w1,1000
WAITUNTIL w1=0
end

SUB w1_handler
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW w1
CASE @IDCLOSEWINDOW
SetWindowLong(w1.hwnd, GWL_WNDPROC, WinOldProc)
CLOSEWINDOW w1
CASE @IDCONTROL
case @idtimer
z++
if z>9 then z=0
y++ :if y>2 then y=0
select y
case 0
clr=rgb(255,0,0)
case 1
clr=rgb(0,255,0)
case 2
clr=rgb(255,255,0)
endselect
select z
case 0
SENDMESSAGE hwndTooltip[0],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[0],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[7],TTM_ACTIVATE,0,0
case 1
SENDMESSAGE hwndTooltip[6],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[6],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[1],TTM_ACTIVATE,0,0
case 2
SENDMESSAGE hwndTooltip[1],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[1],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[3],TTM_ACTIVATE,0,0
case 3
SENDMESSAGE hwndTooltip[8],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[8],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[0],TTM_ACTIVATE,0,0
case 4
SENDMESSAGE hwndTooltip[3],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[3],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[2],TTM_ACTIVATE,0,0
case 5
SENDMESSAGE hwndTooltip[9],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[9],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[6],TTM_ACTIVATE,0,0
case 6
SENDMESSAGE hwndTooltip[5],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[5],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[8],TTM_ACTIVATE,0,0
case 7
SENDMESSAGE hwndTooltip[2],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[2],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[4],TTM_ACTIVATE,0,0
case 8
SENDMESSAGE hwndTooltip[7],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[7],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[9],TTM_ACTIVATE,0,0
case 9
SENDMESSAGE hwndTooltip[4],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[4],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[5],TTM_ACTIVATE,0,0
endselect
    ENDSELECT
RETURN
ENDSUB

SUB MainProc(INT hWin, INT uMsg, INT wParam, INT lParam), INT
pointer pnmhdr : SETTYPE pnmhdr, NMHDR
SELECT uMsg
CASE WM_NOTIFY
pnmhdr = *<NMHDR> lParam
RETURN OnNotify(hWin, #pnmhdr.idFrom, #pnmhdr.code, #pnmhdr.hwndFrom, lParam)
ENDSELECT
RETURN CallWindowProc(WinOldProc, hWin, uMsg, wParam, lParam)
ENDSUB

SUB OnNotify(int hWin, int ctrlid, int code, int hwndCtrl, int lParam), INT
WINRECT rc
POINT pnt

int x
for x=0 to 9
if hwndCtrl = hwndTooltip[x] then breakfor
next x

if x>9 then return 0
SELECT code
CASE TTN_SHOW
GetClientRect(hWin, &rc)
pnt.x = rc.right
pnt.y = rc.bottom
ClientToScreen(hWin, &pnt)
MoveWindow(hwndTooltip[x], px[x]+pnt.x-rc.right, py[x]+pnt.y-rc.bottom, 200, 200, 0)
'MoveWindow(hwndTooltip[x], pa[x].x+pnt.x-200, pa[x].y +pnt.y-200, 200, 200, 0)  
RETURN 1
ENDSELECT

    RETURN 0
ENDSUB

SUB Init()
for x= 0 to 9
hwndTooltip[x] = ToolTipControl(w1, @TTS_ALWAYSTIP|@TTS_BALLOON, 0)
SENDMESSAGE hwndTooltip[x],TTM_SETDELAYTIME,TTDT_INITIAL,0
SENDMESSAGE hwndTooltip[x],TTM_ACTIVATE,0,0
ttAddTool hwndTooltip[x],@TTF_SUBCLASS|@TTF_IDISHWND,w1.hwnd,w1.hwnd,"Black"+str$(x)
next x
   WinOldProc = SetWindowLong(w1.hwnd, GWL_WNDPROC, &MainProc)
ENDSUB



LarryMc
Title: Re: Windows balloon tips ?
Post by: paja on June 17, 2011, 05:27:59 PM
Very nice ! Thanks. And I have two small questons:

1) is possible to set dimensions of balloon tip ?
2) is possible to change the font for ballloon tips


Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 05:31:51 PM
Quote from: paja on June 17, 2011, 05:27:59 PM
Very nice ! Thanks. And I have two small questons:

1) is possible to set dimensions of balloon tip ?
2) is possible to change the font for ballloon tips



1) It automatically adjust to the size of the displayed text. You can set a max width which is how you make it do multiline, as I understand it.
2) there is no simple message to change font that I am aware of.

LarryMc
Title: Re: Windows balloon tips ?
Post by: paja on June 17, 2011, 05:46:56 PM
I asked for font changing because I want to use font with special characters - for example like pictograms.
See font "GuIFx_v2_Transports.ttf".

Paja
Title: Re: Windows balloon tips ?
Post by: LarryMc on June 17, 2011, 05:48:06 PM
did a little more reading and it appears that tooltips does respond to the setfont API(not to be confused with IWBasic's SETFONT command.

LarryMc
Title: Re: Windows balloon tips ?
Post by: paja on June 18, 2011, 01:10:32 PM
The font change solved !

Thanks LarryMc !



$INCLUDE "WindowsSDK.inc"
$INCLUDE "CommCtrl.inc"

Def hfont:UINT

INT WinOldProc
UINT hwndTooltip[10]
int px[10]
int py[10]
px[0]=5,35,65,95,125,155,185,215,245,275
py[0]=5,35,65,95,125,155,185,215,245,275
int z=0,y=0
WINDOW w1
OPENWINDOW w1,0,0,512,347,0x80C80080,0,"Tooltip",&w1_handler
hfont = CreateFontA(15,0,0,0,0,0,0,0,1,0,0,0,2,"Arial")
Init()

starttimer w1,1000
WAITUNTIL w1=0
end

SUB w1_handler
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW w1
CASE @IDCLOSEWINDOW
SetWindowLong(w1.hwnd, GWL_WNDPROC, WinOldProc)
CLOSEWINDOW w1
CASE @IDCONTROL
case @idtimer
z++
if z > 9 then z = 0
y++ :if y > 2 then y = 0
select y
case 0
clr=rgb(255,0,0)
case 1
clr=rgb(0,255,0)
case 2
clr=rgb(25,2,250)
endselect
select z
case 0
SENDMESSAGE hwndTooltip[0],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[0],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[0],TTM_SETTIPTEXTCOLOR,rgb(255,0,0),0
SENDMESSAGE hwndTooltip[7],TTM_ACTIVATE,0,0
case 1
SENDMESSAGE hwndTooltip[6],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[6],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[1],TTM_ACTIVATE,0,0
case 2
SENDMESSAGE hwndTooltip[1],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[1],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[3],TTM_ACTIVATE,0,0
case 3
SENDMESSAGE hwndTooltip[8],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[8],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[0],TTM_ACTIVATE,0,0
case 4
SENDMESSAGE hwndTooltip[3],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[3],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[2],TTM_ACTIVATE,0,0
case 5
SENDMESSAGE hwndTooltip[9],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[9],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[6],TTM_ACTIVATE,0,0
case 6
SENDMESSAGE hwndTooltip[5],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[5],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[8],TTM_ACTIVATE,0,0
case 7
SENDMESSAGE hwndTooltip[2],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[2],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[4],TTM_ACTIVATE,0,0
case 8
SENDMESSAGE hwndTooltip[7],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[7],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[9],TTM_ACTIVATE,0,0
case 9
SENDMESSAGE hwndTooltip[4],TTM_ACTIVATE,1,0
SENDMESSAGE hwndTooltip[4],TTM_SETTIPBKCOLOR,clr,0
SENDMESSAGE hwndTooltip[5],TTM_ACTIVATE,0,0
endselect
    ENDSELECT
RETURN
ENDSUB

SUB MainProc(INT hWin, INT uMsg, INT wParam, INT lParam), INT
pointer pnmhdr : SETTYPE pnmhdr, NMHDR
SELECT uMsg
CASE WM_NOTIFY
pnmhdr = *<NMHDR> lParam
RETURN OnNotify(hWin, #pnmhdr.idFrom, #pnmhdr.code, #pnmhdr.hwndFrom, lParam)
ENDSELECT
RETURN CallWindowProc(WinOldProc, hWin, uMsg, wParam, lParam)
ENDSUB

SUB OnNotify(int hWin, int ctrlid, int code, int hwndCtrl, int lParam), INT
WINRECT rc
POINT pnt

int x
for x=0 to 9
if hwndCtrl = hwndTooltip[x] then breakfor
next x

if x>9 then return 0
SELECT code
CASE TTN_SHOW
GetClientRect(hWin, &rc)
pnt.x = rc.right
pnt.y = rc.bottom
ClientToScreen(hWin, &pnt)
MoveWindow(hwndTooltip[x], px[x]+pnt.x-rc.right, py[x]+pnt.y-rc.bottom, 200, 200, 0)
'MoveWindow(hwndTooltip[x], pa[x].x+pnt.x-200, pa[x].y +pnt.y-200, 200, 200, 0)    
RETURN 1
ENDSELECT

    RETURN 0
ENDSUB

SUB Init()
for x= 0 to 9
hwndTooltip[x] = ToolTipControl(w1, @TTS_ALWAYSTIP|@TTS_BALLOON,0)
SENDMESSAGE hwndTooltip[x],TTM_SETDELAYTIME,TTDT_INITIAL,0
SENDMESSAGE hwndTooltip[x],TTM_ACTIVATE,0,0
ttAddTool hwndTooltip[x],@TTF_SUBCLASS|@TTF_IDISHWND,w1.hwnd,w1.hwnd,"Black"+str$(x)

SendMessage(hwndTooltip[x],WM_SETFONT,hfont,0)

next x
   WinOldProc = SetWindowLong(w1.hwnd, GWL_WNDPROC, &MainProc)
ENDSUB
Title: Re: Windows balloon tips ?
Post by: paja on June 19, 2011, 04:57:22 AM
Hi,

I found two problems:

1) the time for show balloon tips is only short time
2) the balloon tips are shown only when mouse is in defined window and on single and doubleclick are balloon tips
disabled

I need use balloon tips independent on mouse move and positions.

Paja
Title: Re: Windows balloon tips ?
Post by: LarryMc on June 19, 2011, 08:57:39 AM
Quote from: paja on June 19, 2011, 04:57:22 AM
Hi,

I found two problems:

1) the time for show balloon tips is only short time
2) the balloon tips are shown only when mouse is in defined window and on single and doubleclick are balloon tips
disabled

I need use balloon tips independent on mouse move and positions.

Paja

1) that can be adjusted by sending the proper message
2) you could have found that out by reading my post on the 17th where I first posted the code. I listed several conditions I met and indicated that condition was met with the word check. What you 'discovered' was indicated by:
Quotebeep- making it so clicking on the window does not hide the tooltips.
'beep' meaning the condition wasn't met.  I should have been more clear.

Based upon what you have stated about your needs and what I have found playing with tooltips, I suggest you do the following:
1. For each location you want a balloon you create a captionless window and use the @hidden flag when you create it.
2. In your code that controls the moving of the device on the screen you move this hidden window along with it.
3. When you need the window to show you use the SHOWWINDOW command to show the window (after you have set the font, colors, and text to what ever you require)
4. When you no longer need it to show you simply hide it until the next time you need it.
The simple way is to just use a normal rectangle window.  If you insist on it looking like a bubble then you can use the @NOAUTODRAW flag on the window and draw it to look like you want (like a RGNB?UTTON ;) in the processing the @IDPAINT message for the window) (That's where Graham's posted code could be of some help).

LarryMc