comp.lang.ada
 help / color / mirror / Atom feed
From: jboulais@my-deja.com
Subject: Win32 Tool-tip controls in Ada
Date: 1999/11/17
Date: 1999-11-17T00:00:00+00:00	[thread overview]
Message-ID: <80ug1c$tvr$1@nnrp1.deja.com> (raw)

Does anyone have experience using the Win32 Tool-tip control in Ada?
I'm trying to create tool-tips for 2 panes of status windows, one at the
top of my main window, and one at the bottom.  The status window is a
child of the main window, and I created the tool-tip off the status
window.

TopStatusWnd_Tooltip_Handle
   := Win32.Winuser.CreateWindowEx (
         dwExStyle    => 0                                        ,
         lpClassName  => To_Ptr ( Win32.Sikorsky.TOOLTIPS_CLASS ) ,
         lpWindowName => To_Ptr ( "" & Win32.Nul )                ,
         dwStyle      => Win32.Sikorsky.TTS_ALWAYSTIP             ,
         X            => Win32.Winuser.CW_USEDEFAULT              ,
         Y            => Win32.Winuser.CW_USEDEFAULT              ,
         nWidth       => Win32.Winuser.CW_USEDEFAULT              ,
         nHeight      => Win32.Winuser.CW_USEDEFAULT              ,
         hWndParent   => Handle_To_TopStatusWnd                   ,
         hMenu        => System.Null_Address                      ,
         hInstance    => hInstance                                ,
         lpParam      => System.Null_Address                      ) ;

I setup the "regions" (it's a 4 pane status window) for the tool-tips in
a procedure that is called after the above code, which re-sizes my
window to one of 3 distict size.  After that I call another procedure
that fills out both the status windows (which works) and the
corresponding tool-tip for a given, menu selectable status window
configuration. I also set up a windows procedure for the status window
that catches all of the mouse messages and relays them to the tool-tip's
handle.  Bear in mind I had to implement a lot of the bindings for
this, in that they are not in the level 3 win API ( hence the
Win32.Sikorsky package), but we do a lot of that, and I'm fairly
confident that all is well there.  Any suggestions or examples would be
greatly appreciated.

This code is effective called after the above, in a separate procedure
that sizes all of many child windows. It devides up the status window
into the 4 rectangles for it's 4 even sized panes.
------------------------------------------------------------------------
Ignore_BOOL := Win32.Winuser.GetClientRect (
                  hWnd   => Handle_To_TopStatusWnd     ,
                  lpRect => TopStatus_Rectangle'Access ) ;

TopSingleStatus_Length
   := ( TopStatus_Rectangle.right - TopStatus_Rectangle.left )
      / Win32.Long ( Number_Status_Wnd_Panes ) ;

for Top_Index in 0 .. Number_Status_Wnd_Panes - 1 loop

   TopStatusWnd_Tooltip_Info.cbSize
      := Win32.Sikorsky.ToolInfo'size ;

   TopStatusWnd_Tooltip_Info.uflags := 0 ;

   TopStatusWnd_Tooltip_Info.hWnd
      := Handle_To_TopStatusWnd ;

   TopStatusWnd_Tooltip_Info.hInst := hInstance ;

   TopStatusWnd_Tooltip_Info.uId := 0 ;

   TopStatusWnd_Tooltip_Info.lpszText
      := To_Ptr (
            TopStatusWnd_Tooltip_Array ( Win32.INT ( Top_Index ) ) ) ;

   TopStatusWnd_Tooltip_Info.rect.left
      := TopStatus_Rectangle.left +
         Win32.Long ( Top_Index )
            * TopSingleStatus_Length ;

   TopStatusWnd_Tooltip_Info.rect.top := TopStatus_Rectangle.top ;

   TopStatusWnd_Tooltip_Info.rect.right
      := TopStatusWnd_Tooltip_Info.rect.left + TopSingleStatus_Length ;

   TopStatusWnd_Tooltip_Info.rect.bottom := TopStatus_Rectangle.bottom ;

end loop ;

Ignore_LRESULT
   := Win32.Winuser.SendMessage (
         hWnd   => TopStatusWnd_Tooltip_Handle                     ,
         Msg    => Win32.Sikorsky.TTM_ADDTOOL                      ,
         wParam => 0                                               ,
         lParam => To_LPARAM ( TopStatusWnd_Tooltip_Info'address ) ) ;
------------------------------------------------------------------------

-----------------
Jeffrey Boulais
-----------------


Sent via Deja.com http://www.deja.com/
Before you buy.




                 reply	other threads:[~1999-11-17  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox