Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The floating icon trigger for the selected text
#1
Hi,

I want to create a floating icon trigger for the selected text

1. After selecting the text with the left mouse button, a floating icon will be displayed in the upper left corner of the cursor

2. When moving the mouse cursor over the icon, a dialog box is displayed

3. When the mouse cursor moves away from the icon, the dialog box closes

4. If there is no action, the icon will automatically close after 3 seconds

This feature is useful for some common operations with text

Thanks in advance for any advice and help
david

demo pic:

[Image: 1672800378]
#2
I created a dialog box with only one icon

Events when the mouse moves in and out of the window, less accurate, 
How to customize both events:

OnMouseLeave and OnMouseHover

Also, 
1.I want to put the icon in the center of the dialog, but I don't know how to expand it
2.How to wait for the mouse to enter for 3 seconds, otherwise close the dialog box 
3.How to remove the border around the dialog box and show only the icon Huh

Function icon
Code:
Copy      Help
;0 "" 0x90080AC8 0x8 0 0 120 104 "Dialog" "4"
str dd=
;BEGIN DIALOG
;0 "" 0x90080AC8 0x8 0 0 16 16 "Dialog" "4"
;3 Static 0x54000003 0x0 0 0 16 16 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3"
str si3
si3="$qm$\qm.ico"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_MOUSEMOVE
,sub.reDiaSize(120 104 hDlg)
,hid id(3 hDlg)
,
,case WM_NCMOUSELEAVE
,sub.reDiaSize(16 16 hDlg)
,hid- id(3 hDlg)
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

#sub reDiaSize
function w h hDlg

RECT r r1 r2;
r.left = 0; r.top = 0; r.right = w; r.bottom = h;
MapDialogRect(hDlg &r)
DpiGetWindowRect hDlg r1 4; DpiGetWindowRect hDlg r2
int ncah=(r2.bottom-r2.top) - (r1.bottom-r1.top)
int ncaw=(r2.right-r2.left) - (r1.right-r1.left)
siz r.right+ncaw r.bottom+ncah hDlg
hid id(3 hDlg)


Forum Jump:


Users browsing this thread: 1 Guest(s)