PDA

View Full Version : One more off the wall question - Window Always Active?



garretthylltun
09-06-2014, 18:41
I'm making an AppBar program. it's simply just a menubar with no title bar or border that is docked at the top of the screen so that no other programs can cover it or maximize over it, like the Windows TaskBar or SideBar. What I would like to do is retain the look that my menubar is always active, in that, I mean that when the user goes to another program, my menu bar texts doesn't turn gray, like the windows TaskBar and SideBar work.

Is there any way to accomplish this through ThinBasic itself or via an API?

Thanks in advance for any tips or help,
~Garrett

Petr Schreiber
09-06-2014, 19:02
What about this for a start? :)



Uses "UI"

' -- ID numbers of controls
Begin ControlID
%bClose
End ControlID

' -- Create dialog here
Function TBMain()
DWord hDlg
DWord dx, dy

Desktop Get Size To dx, dy

Dialog New Pixels, 0, "",0,0, dx, 40, _
%WS_POPUP | %WS_VISIBLE | %WS_MINIMIZEBOX | %DS_SETFOREGROUND, %WS_EX_TOPMOST To hDlg

Dialog Set Gradient hDlg, %GRADIENT_FILL_V, %WHITE, %BLACK

' -- Place controls here
Control Add Button, hDlg, %bClose, "Click to close", dx-110, 10, 100, 25, Call cbCloseButton

Dialog Show Modal hDlg, Call cbDialog

End Function

' -- Callback for dialog
CallBack Function cbDialog()

' -- Test for messages
Select Case CBMSG

Case %WM_INITDIALOG
' -- Put code to be executed after dialog creation here

Case %WM_COMMAND
' -- You can handle controls here

Case %WM_CLOSE
' -- Put code to be executed before dialog end here

End Select

End Function

' -- Callback for close button
CallBack Function cbCloseButton()

If CBMSG = %WM_COMMAND Then
If CBCTLMSG = %BN_CLICKED Then
' -- Closes the dialog
Dialog End CBHNDL
End If
End If

End Function



Petr

garretthylltun
09-06-2014, 21:31
Petr....... Thank you so very much. It looks like the %DS_SETFOREGROUND is what I needed.

Thanks a bunch,
~Garrett