Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QM_ComboBox SetEditBallonTip
#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


Messages In This Thread
QM_ComboBox SetEditBallonTip - by Davider - 02-14-2023, 09:54 AM
RE: QM_ComboBox SetEditBallonTip - by Kevin - 02-14-2023, 01:49 PM
RE: QM_ComboBox SetEditBallonTip - by Davider - 02-14-2023, 04:06 PM
RE: QM_ComboBox SetEditBallonTip - by Kevin - 02-14-2023, 04:07 PM
RE: QM_ComboBox SetEditBallonTip - by Kevin - 02-14-2023, 05:43 PM
RE: QM_ComboBox SetEditBallonTip - by Davider - 02-14-2023, 11:34 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)