Post by Janet on May 5, 2018 16:08:21 GMT -5
I don't think there will be any pitfalls in removing UpperLeftX and UpperLeftY, but you'd be way more familiar with your users' activity than I would. I added a SetParent API call and a MoveWindow API call and this may be more in keeping what you want. I changed it from a dialog_popup to a window_popup. Not sure it makes a difference either way, but I didn't see a need for a dialog window if it were going to become a child. I'm a little concerned that at least one textbox is 'showing through' on some of the wider tooltips, so it still needs tweaking. Also, in your [quit] routine, you'll want to check if ttFlag = 1 and if it is, then close #tt.
'=========================================================================================================
[RightClickButton] ' graphic 5 , yyy, bttnWidth, bttnHeight
x=val(Tip$(BU,7)) : y=val(Tip$(BU,8)) :bttnWidth=val(Tip$(BU,9)) : bttnHeight=val(Tip$(BU,10))
if ttFlag = 1 then
close #tt
ttFlag = 0
end if
'=========================================================================================================
' Set Popup box and window size--- Need good algorithim
'=========================================================================================================
ttWindowWidth = int(6.3 * Cntrs(BU,2)+20) ' set popup width size maxlinewidth * 6.5
ttWindowHeight =int(20 * Cntrs(BU,1)+35) ' set popup height size Linecnt*20
'---------------------------------------------------------------------------------------------------------
WindowWidth = ttWindowWidth ' Define the pseudo-tooltip window
WindowHeight = ttWindowHeight ' SET EQUAL TO POPUP SIZE !!!!!!!!
'=========================================================================================================
'graphicbox #tt.g 0, 0, ttWindowWidth,ttWindowHeight ' Define a pseudo-tt graphicbox
graphicbox #tt.g 0, 0, ttWindowWidth,ttWindowHeight ' Define a pseudo-tt graphicbox
stylebits #tt, 0,_WS_BORDER,_WS_EX_TOPMOST,0 ' Remove borders and make stay on top with stylebits
open "" for window_popup as #tt ' Open the window as a dialog_popup
ttFlag = 1
#tt "trapclose [closettWindow]"
'---------------------------------------------------------------------------------------------------------
' may need locate
'jlt-------------------------
'Make this new window a child window
hChild = hwnd(#tt)
hParent = hwnd(#main)
calldll #user32, "SetParent", _
hChild as ulong, _
hParent as ulong, _
result as long
' Move the window to desired location
x = 10 : y = BU*25 - 15
calldll #user32, "MoveWindow", _
hChild as ulong, _
10 as long, _
y as long, _
ttWindowWidth as long, _
ttWindowHeight as long, _
1 as long, _
result as long
'' #tt.g "locate ";x;" ";y
#tt.g "down"
#tt.g "fill 255 240 210"
#tt.g "backcolor 255 240 210" ' color tooltip
#tt.g "place 10 15; font Garamond_14" ' Write something in the tooltip
#tt.g "\";R$(BU) ' RU(BU) Tool Tip Data
''#tt.g "\";crlf$;crlf$;"Left-click-here to close"
'---------------------------------------------------------------------------------------------------------
#tt.g "when leftButtonUp [closettWindow]" ' Send left-click to trapclose
goto [LoopEnter] ''wait