April 19, 2024, 01:24:08 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


TOOL TIPS

Started by TexasPete, August 11, 2009, 05:19:25 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TexasPete

I searched the manual for the term tool tips. Nothing came up! In Lb tool tips had to be added via api. Do I have to do the same in CB.

Thanks Texas Pete

ZeroDog

I believe you do need to use API for 'standard' tooltips, however, you can always code your own flavour of tool tips within CBasic if you dont want to use APIs.  I've used the standard API tooltips in a few of my projects, as well as creating my own tooltip functions.  If you need, I can paste some code here when I get home later.

TexasPete

I would love to see an example of a different way to do it. I can always do it the api way but something different would be nice.
to see.
Thanks Texas Pete

mrainey

August 12, 2009, 09:02:23 AM #3 Last Edit: August 12, 2009, 11:05:41 AM by Larry McCaughn
Didn't copy/paste properly.  Can't find a post delete option.


Here's some code done by Sean for IB Standard.  It's not the shortcut you're asking for, but may be useful nonetheless.


setid "CW_USEDEFAULT",&H80000000
setid "WS_VISIBLE",&H10000000
setid "WS_CHILD",&H40000000
def run,tooltip1,tooltip2,button1,button2:int
def win:window
declare AddTooltip(tool:pointer,parent:pointer,text:string,balloon:int)
declare "user32",DestroyWindow(hWnd:int)
declare "user32",FindWindowA(class:string,name:string),int
declare "user32",SetWindowPos(hWnd:int,mode:int,x:int,y:int,w:int,h:int,op:int)
declare "kernel32",GetModuleHandle Alias GetModuleHandleA(mod:int),int
window win,0,0,140,115,@CAPTION|@SYSMENU|@size,0,"Tooltips",mainwin
centerwindow win
declare "user32",CreateWindowExA(ex:int,class:string,name:string,style:int,x:int,y:int,x1:int,y1:int,parent:int,id:int,hinstance:int,ed:int),int
button1=CreateWindowExA(0,"button","Regular Tooltip",@ws_child|@ws_visible,5,5,120,25,win,1,0,0)
button2=CreateWindowExA(0,"button","Balloon Tooltip",@ws_child|@ws_visible,5,45,120,25,win,2,0,0)
clear
CreateWindowExAtooltip1=AddTooltip(button1,win,"This is a standard tooltip!")
tooltip2=AddTooltip(button2,win,"A Balloon Tooltip",1)
run=1
waituntil run=0
closewindow win
DestroyWindow(tooltip1)
DestroyWindow(tooltip2)
END  

mainwin:
select @CLASS
 case @idclosewindow
 run=0
endselect
return

sub AddTooltip(tool:pointer,parent:pointer,text:string,balloon:int)
def hWnd:int
if balloon=1 then balloon=64
declare "user32",CreateWindowExA(ex:int,class:string,name:string,style:int,x:int,y:int,x1:int,y1:int,parent:int,id:int,hinstance:int,ed:int),int hWnd=CreateWindowExA(0,"tooltips_class32","",&h1 | &h80000000 | balloon,@cw_usedefault,@cw_usedefault,@cw_usedefault,@cw_usedefault,0,0,0,0)
SetWindowPos(hWnd,-1,0,0,0,0,&h2 | &h1 | &h10)
type TOOLINFO
 def cbSize:int
  def uFlags:int
  def hwnd:int
  def uId:int
  def left:int
 def top:int
 def right:int
 def bottom:int
 def hInst:int
  def Text:string
 def lParam:int
 endtype
def ti:TOOLINFO
ti.cbSize=44
ti.uFlags=&h1 |&h10
ti.hWnd=#parent
ti.uId=#tool
ti.hInst=0
ti.Text=text
declare "user32",SendMessageA(hWnd:int,message:int,wParam:int,lparam:TOOLINFO),int
 ret=SendMessageA(hWnd,1028,0,ti)
clear
SendMessageA sendmessage(hWnd,1025,1,0)
clear
CreateWindowExA
return hWnd
Software For Metalworking
http://closetolerancesoftware.com

TexasPete

mrainy, Thank you very much. It looks like tha api version. I will tinker with it until I become comfortable.

Texas Pete