Two ways I can think of that will work. They are cheats but the user will never know.
Both snippets tested on XP only.
1. Use a StringGadget during Animation then swap it out in favor of the EditorGadget afterwards.
Code: Select all
If OpenWindow(0, -65000, -65000, 470, 120, "Animate Test", #PB_Window_SystemMenu)
ShowWindow_(WindowID(0), #SW_HIDE)
ResizeWindow(0, 100, 100, #PB_Ignore, #PB_Ignore)
EditorGadget(0, 10, 10, 450, 100)
HideGadget(0, 1)
SetGadgetColor(0, #PB_Gadget_BackColor, #Green)
SetGadgetText(0, "You can see this while Animation is in progress.")
StringGadget(1, 10, 10, 450, 100, "You can see this while Animation is in progress.")
SetGadgetColor(1, #PB_Gadget_BackColor, #Green)
AnimateWindow_(WindowID(0), 1000, #AW_CENTER | #AW_ACTIVATE)
FreeGadget(1)
HideGadget(0, 0)
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf
2. If you need the extra formatting options that come with the EditorGadget, then use PrintWindow API (Win 2k and later only). You then grab just the EditorGadget bits and place it in an ImageGadget which will animate as you desire. When animation is complete you swap out the ImageGadget for your EditorGadget.
Code: Select all
If OSVersion() < #PB_OS_Windows_2000
End
Else
Prototype.l pPrintWindow(hwnd.l, hdc.l, lFlags.l)
hLib = OpenLibrary(#PB_Any , "user32.dll")
Global _PrintWindow.pPrintWindow = GetFunction(hLib , "PrintWindow")
EndIf
Procedure DoAnimation(hwnd)
GetWindowRect_(WindowID(0), @winRc.RECT)
x = GadgetX(0) + GetSystemMetrics_(#SM_CXFIXEDFRAME)
y = GadgetY(0) + GetSystemMetrics_(#SM_CYCAPTION) + GetSystemMetrics_(#SM_CXFIXEDFRAME)
w = winRc\right - winRc\left
h = winRc\bottom - winRc\top
If w > 0 And h > 0
dummyImg = CreateImage(#PB_Any, w, h)
destDC = StartDrawing(ImageOutput(dummyImg))
_PrintWindow(hwnd, destDC, 0)
StopDrawing()
CreateImage(#PB_Any, w, h)
clientImg = GrabImage(dummyImg, #PB_Any, x, y, w, h)
HideGadget(0, 1)
dummy = ImageGadget(#PB_Any, 10, 10, 450, 100, ImageID(clientImg))
EndIf
ShowWindow_(WindowID(0), #SW_HIDE)
ResizeWindow(0, 30, 30, 470, 120)
AnimateWindow_(WindowID(0), 1000, #AW_CENTER | #AW_ACTIVATE)
HideGadget(0, 0)
FreeGadget(dummy)
EndProcedure
If OpenWindow(0, -65000, -65000, 470, 120, "Animate Test", #PB_Window_SystemMenu)
EditorGadget(0, 10, 10, 450, 100)
SetGadgetColor(0, #PB_Gadget_BackColor, #Green)
SetGadgetText(0, "You can see this while Animation is in progress.")
cf.CHARFORMAT
cf\cbSize = SizeOf(cf)
cf\dwMask = #CFM_SIZE
cf\yHeight = 400
SendMessage_(GadgetID(0), #EM_SETSEL, 23, 32)
SendMessage_(GadgetID(0), #EM_SETCHARFORMAT, #SCF_SELECTION, cf)
SendMessage_(GadgetID(0), #EM_SETSEL, -1, 0)
DoAnimation(WindowID(0))
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf