Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Buttons Disappearing
#1
Hi Gintaras,
Hope all is well. Haven't written to the forum in a while but still deep in the QM world!
I hope this is an easy one...
I use a dialog based menu in an exe that has buttons that intermittently and randomly disappear.

It's not exactly the code below but similar (transparencies, moves based on parent window)

Even though the screen behind the missing button is visible, it stills shows positive if I do a check on whether the child id item exists. Is it some sort of clipping issue?
Thanks for any thoughts on solutions or at least ideas to explore!
Stuart

Function TestExeDlgMenu
Code:
Copy      Help
\Dialog_Editor

function# hDlg message wParam lParam
if(hDlg) goto messages

CloseWindowsOf("DlgMenu" "#32770");err
run "$system$\notepad.exe" "" "" "" 0x1800 win("Notepad" "Notepad")
if(!ShowDialog("TestExeDlgMenu" &TestExeDlgMenu 0)) ret

;BEGIN DIALOG
;0 "" 0x80000840 0x90 0 0 385 11 "DlgMenu"
;3 Button 0x54032000 0x0 0 0 48 11 "Button1"
;4 Button 0x54032000 0x0 48 0 48 11 "Button2"
;5 Button 0x54032000 0x0 96 0 48 11 "Button3"
;6 Button 0x54032000 0x0 144 0 48 11 "Button4"
;7 Button 0x54032000 0x0 192 0 48 11 "Button5"
;8 Button 0x54032000 0x0 240 0 48 11 "Button6"
;9 Button 0x54032000 0x0 288 0 48 11 "Button7"
;10 Button 0x54032000 0x0 336 0 48 11 "Button8"
;1 Button 0x54030001 0x4 64 402 48 11 "OK"
;2 Button 0x54030000 0x4 118 402 48 11 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030502 "*" "" "" ""




ret
;messages
sel message
,case WM_INITDIALOG
,__GdiHandle-- hb=CreateSolidBrush(0xff00)
,Transparent hDlg 255 0xff00
,int+ NotePadHwnd = win("Notepad" "Notepad")
,SetWindowLong hDlg GWL_HWNDPARENT NotePadHwnd
,SetTimer hDlg 1 100 0
,;SendMessage hDlg WM_COMMAND 5 0 ;;execute gButton code. Or use function instead.
,SendMessage hDlg WM_TIMER 1 0 ;;execute gTimer code. Or use function instead.    
,case WM_TIMER
,sel wParam
,,case 1 goto gTimer    
,case WM_DESTROY    
,case WM_CTLCOLORDLG ret hb
,case WM_COMMAND goto messages2
,
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

;gButton
ret

;gTimer
Zorder hDlg HWND_TOP SWP_NOACTIVATE
int x_NotePad y_NotePad cx_NotePad cy_NotePad;
ifi(NotePadHwnd)    
,GetWinXY NotePadHwnd x_NotePad y_NotePad cx_NotePad cy_NotePad
else
,CloseWindowsOf("DlgMenu" "#32770");err
,ret
int x_Dlg y_Dlg cx_Dlg cy_Dlg
GetWinXY hDlg x_Dlg y_Dlg cx_Dlg cy_Dlg
MoveWindow hDlg x_NotePad+25 y_NotePad+3 cx_NotePad-100 cy_Dlg 1;;need to leave enough room for max/min/close app dlg frame buttons and enough of frame to grab for moving/resizing
#2
Here buttons don't disappear. And shouldn't.
#3
maybe I am having different results because I am doing some max and siz effects on the toolbar and it's not the same exact code as in the example but hard to simplify for forum posting. One thing in my actual dialog is that the buttons are painted with SendMessage of BM_SETIMAGE IMAGE_BITMAP. When I check whether a individual button is visible or not, it returns visible and hid- doesn't work on the individual button cid. However, if I hid then hid- the whole dialog hwnd, the missing buttons reappear. Could this be related to WS_CLIPCHILDREN. I realized I didn't have that on the parent dialog. Will try to add this and see whether this intermittent problem goes away. Any thoughts?
Thanks so much,
S


Forum Jump:


Users browsing this thread: 1 Guest(s)