Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tray icon & dialog ?
#1
Hi Gint !

I would like to have the option to open/reopen my Main dialog by using Tray icon.

i was wondering how to "close" the dialog and "save" its current state...?

for example ;

Dialog has a start/stop button ,i hit start ,i close dialog and reopen it by using the tray icon.
How to keep the button pushed/showing right text?

my first idea
I thought to check running functions below WM_INITDIALOG and set button text (start,stop) based on that.

well thats the "i want to get it running" idea :lol:

im sure theres a better way!?

Thanks alot
#2
Function Dialog223
Trigger F3     Help - how to add the trigger to the macro
Code:
Copy      Help
,case IDCANCEL
,hid hDlg
,ret 0


Function TrayProc
Code:
Copy      Help
;/
function Tray&tray msg

sel msg
,case WM_LBUTTONUP
,,hid- "Dialog"


that would work ,well would modify Tray proc to see if dialog function is running .. if is running unhide else rund the function...
#3
Correct.

Other version.
Function dialog_tray_icon
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("dialog_tray_icon" &dialog_tray_icon 0)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;2 Button 0x54030000 0x4 120 116 48 14 "Hide"
;3 Button 0x54032000 0x0 172 116 48 14 "Exit"
;END DIALOG
;DIALOG EDITOR: "" 0x2030300 "*" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,Tray-- t_ti
,t_ti.AddIcon("$qm$\copy.ico" "tooltip" 5 hDlg)
,;clo hDlg ;;hide
,
,case WM_DESTROY
,t_ti.Delete
,
,case WM_USER+101
,sel lParam
,,case WM_LBUTTONUP ;;on left click tray icon
,,;gShow
,,act hDlg; err
,,
,,case WM_RBUTTONUP ;;on right click tray icon
,,sel ShowMenu("1 Show[]2 Exit" hDlg)
,,,case 1 goto gShow
,,,case 2 goto gExit
,
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDCANCEL ;;Hide, X
,min hDlg; hid hDlg; ret
,
,case 3 ;;Exit
,;gExit
,DT_Cancel hDlg
ret 1
#4
So basically my idea was right but to be honest i was far away from your code...

i used the example thats in system folder (Tray_sample_use_function + TryProc + my Dialog) so i already had 3 functions constantly running... didnt think of having it all in the dialog. Thats very nice!

Well it always amazing to see your Ideas !!

I just dont understand why it doesnt need a Messageloop in Dialog ?


best regards.
#5
The message loop is deep in ShowDialog.


Forum Jump:


Users browsing this thread: 1 Guest(s)