i am trying to add a window fading in/out routine to my very simple and small program. first i tried it with SetLayeredWindowAttributes_ but i doesnt worked for fading off. many thanxx to GreenGiant who showing me another way using AnimateWindow_! His AnimateWindow example works very fine and is exactly what i needed!
i added the AnimateWindow_ fading in/out routine but it does not really works! when the fading works, it will display only the window and only one gadget (the OK buttongadget) but Frame3D and StringGadget are still invisble while fading window in and even if window is complete faded in! how is this possible? when using RedrawWindow_ after AnimateWindow_ (fading window in), the invisible objects will be shown after fading! But i want to fade in the window with all needed objects (window, ok-button, frame3d, stringgadget)

try enable/disable the lines:
Code: Select all
HideWindow(#Window_Main,0)
Code: Select all
RedrawWindow_(WindowID(#Window_Main), 0, 0, 7)
here is the link where i asked for another problem and stopped with this problem. so i created a new topic! viewtopic.php?t=12397
just try out this cutted source. someone having same problems with invisble objects? compiled with pb3.91 - windows2000, sp4 - thanxx
Code: Select all
cWindowMainTitle$ = "bla"
#winw = 453
#winh = 428
#AW_BLEND = $80000 ; AnimateWindow
#AW_HIDE = $10000 ; AnimateWindow
#AW_ACTIVATE = $20000
; -----------------------------------------------------------------------------------------------------------
; D e f i n e W i n d o w a n d G a d g e t N u m b e r s
; -----------------------------------------------------------------------------------------------------------
Enumeration
#Window_Main
#Window_Invisible
#Gad_Main_Banner
#Gad_Main_StringGadget
#Gad_Main_OK
#Gad_Main_Edit
;
#Gad_Config_LoadText
#Gad_Config_SaveText
#Gad_Config_CreateData
#Gad_Config_RestoreData
#Gad_Config_Back
EndEnumeration
Global hWnd, hWnd_Main
Global cAdminsMessage$, cRootFolder$, cUserLoggedOn$, cUserLoggedOnMD5$, cEditorText$
Global lConfigMode, cPassWord$
Global lFade,lFadeStep
Procedure MyHideWindowFromTaskbar(lWindowID, lNewWindowHandle, lMode)
If lMode=1
HideWindow(lWindowID,1)
EndIf
SetWindowLong_(WindowID(lWindowID),#GWL_HWNDPARENT,lNewWindowHandle)
ProcedureReturn
EndProcedure
; -----------------------------------------------------------------------------------------------------------
; C r e a t e W i n d o w s a n d G a d g e t s
; -----------------------------------------------------------------------------------------------------------
; -------- Window Invisible --------
OpenWindow(#Window_Invisible, 0, 0, 0, 0, #PB_Window_Invisible,"")
HideWindow(#Window_Invisible, 1) ; 1 = hide
; -------- Main_Window --------
hWnd_Main = OpenWindow(#Window_Main, 0, 119, #winw, #winh, #PB_Window_Invisible | #PB_Window_WindowCentered , cWindowMainTitle$)
SetWindowPos_(WindowID(#Window_Main), #HWND_TOPMOST, 0, 0, 0, 0, #SWP_NOMOVE|#SWP_NOSIZE) ;Ever on TOP of other Appz
MyHideWindowFromTaskbar(0, WindowID(#Window_Invisible), 0)
;---- Enable this line and see that the STringGadget and Frame3D object are still created!
;
; HideWindow(#Window_Main,0)
; -------- Main_Window - Create Gadgets --------
If CreateGadgetList(WindowID(#Window_Main))
;{
; -------- Gadgets for Main Page --------
;
Frame3DGadget(77,0,102,453,4,"",#PB_Frame3D_Flat)
StringGadget(#Gad_Main_StringGadget, 20, 115, 410, 270, "",#PB_String_MultiLine|#PB_String_ReadOnly|#ES_AUTOVSCROLL|#WS_VSCROLL| #ESB_DISABLE_LEFT| #ESB_DISABLE_RIGHT )
ButtonGadget(#Gad_Main_OK, 190, 395, 50, 25, "OK")
ButtonGadget(#Gad_Main_Edit, 380, 395, 50, 25, "Edit")
;
; -------- Gadgets for Config Page --------
;
ButtonGadget(#Gad_Config_LoadText, 20, 395, 80, 25, "Bla1")
ButtonGadget(#Gad_Config_SaveText, 100, 395, 80, 25, "Bla2")
ButtonGadget(#Gad_Config_CreateData, 200, 395, 80, 25, "Bla3")
ButtonGadget(#Gad_Config_RestoreData, 280, 395, 80, 25, "Bla4")
ButtonGadget(#Gad_Config_Back, 380, 395, 50, 25, "Bla5")
;}
EndIf
; -------- Hide Gadgets for Main and Config Page --------
HideGadget(#Gad_Main_Edit , 1)
HideGadget(#Gad_Config_LoadText , 1) ; 1 = Hide all Config Gadgets
HideGadget(#Gad_Config_SaveText , 1)
HideGadget(#Gad_Config_CreateData , 1)
HideGadget(#Gad_Config_RestoreData, 1)
HideGadget(#Gad_Config_Back , 1)
; -------- FadeIn Window -------- ; Funktioniert erst wenn in Repeat Until loop
;---- B U G ????????
AnimateWindow_(WindowID(#Window_Main),1000,#AW_BLEND)
; RedrawWindow_(WindowID(#Window_Main), 0, 0, 7)
; -----------------------------------------------------------------------------------------------------------
; W i n d o w C a l l B a c k - K e y b o a r d E v e n t s ^ ^ H i d d e n P a r t s ^ ^
; -----------------------------------------------------------------------------------------------------------
Procedure MyWindowCallback(lWindowID,lMessage,wParam,lParam)
res = #PB_ProcessPureBasicEvents
If lMessage=#WM_KEYDOWN
; -------- CHeck keyboard inputs for hidden parts --------
If wParam = 13 Or Len(cPassWord$) > 64
cPassWord$ = ""
Else
cPassWord$ = cPassWord$ + Chr(wParam)
EndIf
Debug cPassWord$
If wParam = 86 ; GadgetID;Asc(86)
MessageRequester("bla","bla",0)
EndIf
Select cPassWord$
Case "PASSWORD1"
Case "PASSWORD2"
EndSelect
EndIf
ProcedureReturn res
EndProcedure
SetWindowCallback(@MyWindowCallback())
; -----------------------------------------------------------------------------------------------------------
; M a i n L o o p
; -----------------------------------------------------------------------------------------------------------
Repeat
lEvent = WaitWindowEvent()
;
If lEvent = #PB_EventGadget
lGadgetID = EventGadgetID()
Select lGadgetID
Case #Gad_Main_OK
lEvent = #PB_EventCloseWindow
EndSelect
EndIf
Until lEvent = #PB_EventCloseWindow
; -------- FadeOff Window --------
AnimateWindow_(WindowID(#Window_Main),1000,#AW_BLEND | #AW_HIDE)
End