Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QM_ComboBox SetEditBallonTip
#1
Hi,
I want to add BallonTip to the QM_ComboBox control, It cannot be displayed using the following code
As shown in the picture below
[Image: 1676627407]

In addition:
 need to display the tooltip text (e.g: 3 Edit 0x54030080 0x200 8 8 104 14 "" "1 help txt") for each control in the BallonTip prompt box (Line49), Is that possible?

Thanks in advance for any advice and help
david

Macro QMCB
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x8 0 0 120 174 "Dynamic Dialog"
;3 Edit 0x54030080 0x200 8 8 104 14 "" "1 help txt"
;4 Edit 0x54030080 0x204 8 32 104 14 "" "2 help txt"
;5 QM_ComboBox 0x54030242 0x0 8 60 96 13 "" "3 help txt"
;1 Button 0x54030001 0x4 16 152 40 14 "OK"
;2 Button 0x54030000 0x0 64 152 40 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "" "" "" ""

str controls = "3 4 5"
str e3 e4 qmcb5

if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,int i; ARRAY(str) as; tok(controls as)
,for _i 0 as.len
,,i=val(as[_i])
,,_s.getwintext(id(i hDlg)); _s.trim
,,
,,int cid=id(i hDlg)
,,if empty(_s)
,,,act cid
,,,sub.SetEditBallonTip(i hDlg)
,,,ret
,case IDCANCEL
ret 1

#sub SetEditBallonTip
function cid hwnd
EDITBALLOONTIP ebt
ebt.cbStruct=sizeof(ebt)
ebt.pszTitle=@"ERR"
ebt.ttiIcon=TTI_ERROR
;Todo: How to Add tooltip text e.g: ebt.pszText=@"Can't be empty[] tooltiptext"
ebt.pszText=@"Can't be empty"
SendMessage(id(cid hwnd) EM_SHOWBALLOONTIP 0 &ebt)
#2
combobox  edit control has different id

Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x8 0 0 120 174 "Dynamic Dialog"
;3 Edit 0x54030080 0x200 8 8 104 14 "test" "1 help txt"
;4 Edit 0x54030080 0x204 8 32 104 14 "" "2 help txt"
;5 QM_ComboBox 0x54030242 0x0 8 60 96 13 "" "3 help txt"
;1 Button 0x54030001 0x4 16 152 40 14 "OK"
;2 Button 0x54030000 0x0 64 152 40 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "" "" "" ""

str controls = "3 4 5"
str e3 e4 qmcb5

if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,int hwnd=id(5 hDlg)
,out hwnd
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,int i; ARRAY(str) as; tok(controls as)
,for _i 0 as.len
,,i=val(as[_i])
,,str cls.getwinclass(id(i hDlg))
,,int cid
,,if(cls="QM_ComboBox" or cls="ComboBox")
,,,cid=child("" "" id(i hDlg))
,,else
,,,cid=id(i hDlg)
,,_s.getwintext(cid); _s.trim    
,,if empty(_s)
,,,act cid
,,,sub.SetEditBallonTip(cid dd)
,,,ret
,case IDCANCEL
ret 1

#sub SetEditBallonTip
function chwnd ~dd1
int cid=GetWinId(chwnd)
if cid>1000
,int w=GetAncestor(chwnd 1)
,cid=GetWinId(w)
str TTtext
sub.GetTooltipText(cid dd1 TTtext)
EDITBALLOONTIP ebt
ebt.cbStruct=sizeof(ebt)
ebt.pszTitle=@"ERR"
ebt.ttiIcon=TTI_ERROR
ebt.pszText=@F"Can't be empty[]{TTtext}"
SendMessage(chwnd EM_SHOWBALLOONTIP 0 &ebt)
#sub GetTooltipText
function cid ~dd ~&ttText
str s
ARRAY(str) a
str pattern="'' ''(.+?)''$"
foreach s dd
,if(s.beg(F"{cid}"))
,,findrx(s pattern 0 1 a 1)
,,if(a.len)
,,,break
ttText=a
ttText.trim
#3
If there are multiple QM_ComboBox controls, How to judge?


Macro Macro5
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x8 0 0 120 174 "Dynamic Dialog"
;3 Edit 0x54030080 0x200 8 8 104 14 "" "1 help txt"
;4 Edit 0x54030080 0x204 8 32 104 14 "" "2 help txt"
;5 QM_ComboBox 0x54030242 0x0 8 60 96 13 "" "3 help txt"
;6 QM_ComboBox 0x54030242 0x4 8 88 96 13 "" "4 help txt"
;7 QM_ComboBox 0x54030242 0x4 8 116 96 13 "" "5 help txt"
;1 Button 0x54030001 0x4 16 152 40 14 "OK"
;2 Button 0x54030000 0x0 64 152 40 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "" "" "" ""

str controls = "3 4 5 6 7"
str e3 e4 qmcb5 qmcb6 qmcb7

if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,int i; ARRAY(str) as; tok(controls as)
,for _i 0 as.len
,,i=val(as[_i])
,,_s.getwintext(id(i hDlg)); _s.trim
,,int cid=id(i hDlg)
,,if empty(_s)
,,,if i=5
,,,,i=1001
,,,act cid
,,,sub.SetEditBallonTip(i hDlg)
,,,ret
,case IDCANCEL
ret 1

#sub SetEditBallonTip
function cid hwnd
EDITBALLOONTIP ebt
ebt.cbStruct=sizeof(ebt)
ebt.pszTitle=@"ERR"
ebt.ttiIcon=TTI_ERROR
ebt.pszText=@"Can't be empty"
SendMessage(id(cid hwnd) EM_SHOWBALLOONTIP 0 &ebt)
#4
see updated post #2 above
#5
also added in your todo request to post #2
#6
worked well, thanks for your help!


Forum Jump:


Users browsing this thread: 2 Guest(s)