Page 2 of 2
Posted: Fri Oct 06, 2006 4:06 pm
by Blue
Bonne_den_kule:
Very nice! Thank you for sharing your idea with us.
netmaestro:
netmaestro wrote:[...] no more hourglass for you[...]
Code: Select all
Procedure ShowWindow(window)
... thread for fader ...
EndProcedure
Procedure.l CreatePopupMessage(*DeviceName.s)
...
tid = CreateThread(@ShowWindow(),window)
...
EndProcedure
I love how you've simplified the code -- and added a lot of clarity to it -- by simply packaging the fader code in a separately threaded procedure. Brilliant. But is there some other advantage to doing things this way ? (besides making things a whole lot easier to understand and maintain!)
thanks.
[Later... Much later!]
"Oh! I see." said the blind man
I guess the thread IS the reason WHY the hourglass cursor disappears. Because the code runs independently, it does not have to either wait or keep anybody waiting. Hence, no need for the hourglass.
Does that sound right?
Do I get the little gold star ?
Posted: Mon Aug 04, 2008 6:09 am
by idle
know its old but if you want a sliding window as well as fade
Code: Select all
#WindowLength=180
#WindowHeight=50
Global rect.RECT
Procedure ShowWindow(window)
HideWindow(Window, 0)
sf.f = (1-#WindowLength) / (1-255)
For i=0 To 255 Step 10
sX = (i * sf) - #WindowLength
MoveWindow_(WindowID(window),rect\right-#WindowLength-Sx,(rect\bottom-#WindowHeight)-Sy,#WindowLength,#WindowHeight,1)
SetLayeredWindowAttributes_(WindowID(window), 0, i, 2)
Delay(20)
Next
Delay(1250)
For i=255 To 0 Step -10
sX = (i * sf) - #WindowLength
MoveWindow_(WindowID(window),rect\right-#WindowLength-Sx,(rect\bottom-#WindowHeight)-Sy,#WindowLength,#WindowHeight,1)
SetLayeredWindowAttributes_(WindowID(window), 0, i, 2)
Delay(20)
Next
EndProcedure
Procedure.l CreatePopupMessage(*DeviceName.s)
Define Window.l, DummyWindow.l, i.l, TextGadget
SystemParametersInfo_(#SPI_GETWORKAREA,0,rect.RECT,0)
DummyWindow.l=OpenWindow(#PB_Any, 0, 0, 0, 0, "", #PB_Window_Invisible)
Window=OpenWindow(#PB_Any, rect\right-#WindowLength, rect\bottom-#WindowHeight, #WindowLength, #WindowHeight, "Audio Device", #WS_POPUPWINDOW|#WS_DISABLED|#PB_Window_Invisible, WindowID(DummyWindow))
SetWindowLong_(WindowID(window), #GWL_EXSTYLE,GetWindowLong_(WindowID(window),#GWL_EXSTYLE)|#WS_EX_LAYERED )
If Window
If CreateGadgetList(WindowID(Window))
TextGadget=TextGadget(#PB_Any, 10, 10, 160, 30, "You have male:"+Chr($0A)+*DeviceName)
EndIf
StickyWindow(Window, 1)
SetWindowColor(Window, RGB(255, 255, 255))
tid = CreateThread(@ShowWindow(),window)
EndIf
Repeat:
WaitWindowEvent(1)
Until Not IsThread(tid)
CloseWindow(Window)
CloseWindow(DummyWindow)
EndProcedure
CreatePopupMessage(@"WTF!")
[/code]
Posted: Mon Aug 04, 2008 11:28 am
by Kwai chang caine
Cool

Posted: Mon Aug 04, 2008 12:40 pm
by Wolf
Nice

Posted: Mon Aug 04, 2008 2:55 pm
by rsts
Very nice. Thanks for sharing.
(in my case it would be 'mail')
cheers
Posted: Mon Aug 04, 2008 11:10 pm
by idle
rsts wrote:Very nice. Thanks for sharing.
(in my case it would be 'mail')
cheers
just for your amusement, the needed file
http://www.idlearts.com/msg.zip
it's an ogg file and server refuses to fetch them.
Code: Select all
#WindowLength=180
#WindowHeight=50
Global rect.RECT
Procedure ShowWindow(window)
HideWindow(Window, 0)
sy.l
sf.f = (1-#WindowLength) / (1-255)
sfy.f = (1-#WindowHeight) /(1-255)
PlaySound(0)
For i=0 To 255 Step 10
sX = (i * sf) - #WindowLength
MoveWindow_(WindowID(window),rect\right-#WindowLength-Sx,(rect\bottom-#WindowHeight)-Sy,#WindowLength,#WindowHeight,1)
SetLayeredWindowAttributes_(WindowID(window), 0, i, 2)
Delay(30)
Next
Delay(2000)
For c = 1 To 25
For a = 0 To 255 Step 10
sY = a * sfy
MoveWindow_(WindowID(window),rect\right-#WindowLength-Sx,(rect\bottom-#WindowHeight)-Sy,#WindowLength,#WindowHeight,1)
Delay(4)
Next
For d = 255 To 0 Step - 10
sY = d * sfy
MoveWindow_(WindowID(window),rect\right-#WindowLength-Sx,(rect\bottom-#WindowHeight)-Sy,#WindowLength,#WindowHeight,1)
Delay(4)
Next
Next
For i=255 To 0 Step -2
sX = (i * sf) - #WindowLength
MoveWindow_(WindowID(window),rect\right-#WindowLength-Sx,(rect\bottom-#WindowHeight)-Sy,#WindowLength,#WindowHeight,1)
SetLayeredWindowAttributes_(WindowID(window), 0, i, 2)
Delay(30)
Next
Delay(15000)
EndProcedure
Procedure.l CreatePopupMessage(*DeviceName.s)
Define Window.l, DummyWindow.l, i.l, TextGadget
SystemParametersInfo_(#SPI_GETWORKAREA,0,rect.RECT,0)
DummyWindow.l=OpenWindow(#PB_Any, 0, 0, 0, 0, "", #PB_Window_Invisible)
Window=OpenWindow(#PB_Any, rect\right-#WindowLength, rect\bottom-#WindowHeight, #WindowLength, #WindowHeight, "Audio Device", #WS_POPUPWINDOW|#WS_DISABLED|#PB_Window_Invisible, WindowID(DummyWindow))
SetWindowLong_(WindowID(window), #GWL_EXSTYLE,GetWindowLong_(WindowID(window),#GWL_EXSTYLE)|#WS_EX_LAYERED )
If Window
If CreateGadgetList(WindowID(Window))
TextGadget=TextGadget(#PB_Any, 10, 10, 160, 30, "You have male:"+Chr($0A)+*DeviceName)
SetGadgetColor(TextGadget,#PB_Gadget_BackColor,RGB(255,255,255))
EndIf
StickyWindow(Window, 1)
SetWindowColor(Window, RGB(255, 255, 255))
tid = CreateThread(@ShowWindow(),window)
EndIf
Repeat:
WaitWindowEvent(1)
Until Not IsThread(tid)
CloseWindow(Window)
CloseWindow(DummyWindow)
EndProcedure
InitSound()
UseOGGSoundDecoder()
len = CatchSound(0, ?Music,154116)
CreatePopupMessage(@"WTF!")
DataSection
Music: IncludeBinary "c:\msg.ogg"
EndDataSection
Posted: Tue Aug 05, 2008 1:02 am
by jack
idle the link is broken

Posted: Tue Aug 05, 2008 1:22 am
by Wolf
idle nice work, please add to next version joystick support !
Posted: Tue Aug 05, 2008 1:23 am
by idle
jack wrote:idle the link is broken

I'll have to zip it, there's a problem on the server.
done, edited the previous post
wolf wrote: idle nice work, please add to next version joystick support
you may regret having said that once you've heard the msg. specifically the reference to joystick

Posted: Tue Aug 05, 2008 1:52 am
by Intrigued
idle wrote:know its old but if you want a sliding window as well as fade
Code: Select all
#WindowLength=180
#WindowHeight=50
Global rect.RECT
Procedure ShowWindow(window)
HideWindow(Window, 0)
sf.f = (1-#WindowLength) / (1-255)
For i=0 To 255 Step 10
sX = (i * sf) - #WindowLength
MoveWindow_(WindowID(window),rect\right-#WindowLength-Sx,(rect\bottom-#WindowHeight)-Sy,#WindowLength,#WindowHeight,1)
SetLayeredWindowAttributes_(WindowID(window), 0, i, 2)
Delay(20)
Next
Delay(1250)
For i=255 To 0 Step -10
sX = (i * sf) - #WindowLength
MoveWindow_(WindowID(window),rect\right-#WindowLength-Sx,(rect\bottom-#WindowHeight)-Sy,#WindowLength,#WindowHeight,1)
SetLayeredWindowAttributes_(WindowID(window), 0, i, 2)
Delay(20)
Next
EndProcedure
Procedure.l CreatePopupMessage(*DeviceName.s)
Define Window.l, DummyWindow.l, i.l, TextGadget
SystemParametersInfo_(#SPI_GETWORKAREA,0,rect.RECT,0)
DummyWindow.l=OpenWindow(#PB_Any, 0, 0, 0, 0, "", #PB_Window_Invisible)
Window=OpenWindow(#PB_Any, rect\right-#WindowLength, rect\bottom-#WindowHeight, #WindowLength, #WindowHeight, "Audio Device", #WS_POPUPWINDOW|#WS_DISABLED|#PB_Window_Invisible, WindowID(DummyWindow))
SetWindowLong_(WindowID(window), #GWL_EXSTYLE,GetWindowLong_(WindowID(window),#GWL_EXSTYLE)|#WS_EX_LAYERED )
If Window
If CreateGadgetList(WindowID(Window))
TextGadget=TextGadget(#PB_Any, 10, 10, 160, 30, "You have male:"+Chr($0A)+*DeviceName)
EndIf
StickyWindow(Window, 1)
SetWindowColor(Window, RGB(255, 255, 255))
tid = CreateThread(@ShowWindow(),window)
EndIf
Repeat:
WaitWindowEvent(1)
Until Not IsThread(tid)
CloseWindow(Window)
CloseWindow(DummyWindow)
EndProcedure
CreatePopupMessage(@"WTF!")
[/code]
Nice idle!
Thanks
Posted: Tue Aug 05, 2008 2:05 am
by rsts
cheers
Posted: Tue Aug 05, 2008 8:44 am
by Kwai chang caine

Too much !!!!
I have dancing on the desktop
Congratulation

Posted: Wed Aug 06, 2008 3:26 pm
by superadnim
Awesome thanks

(I'm still laughing!)