Announcement

Collapse
No announcement yet.

Animations in the statusbar

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Andrew Lindsay
    replied
    Guys,

    Thanks for your help, this is exactly what I was after.

    Regards

    Andrew

    Leave a comment:


  • Cliff Nichols
    replied
    Nice Example
    and fully compile-able without any mods...I like that.

    Leave a comment:


  • Roger Garstang
    replied
    Haven't done it with a Statusbar, but I have used an ANI file before in a image control. Perhaps it will work there as well, then no need for a timer solution...otherwise Timer is pretty much it unless you combine a picture control and take the child of Statusbar approach. I did what MCM suggested before and did a SetParent making a progressbar a child and it worked fine.

    Leave a comment:


  • Dave Biggs
    replied
    You could get an animation effect by using a timer to cycle through a succession of images placed on the status bar with SB_SETICON.
    Another way could be to place an image control displaying an animated icon over the status bar. Something like this..
    Code:
    #Compile Exe
    #Dim All
    #Include  "Win32API.inc"
    '#Resource "Sb Test.pbr"                        ' Un-rem if using icon from resource
     
    ' Not built-in (copied from CommCtrl.inc)
    %SB_GETRECT           = %WM_USER + 10
    %SB_SETICON           = %WM_USER + 15
    'Equates
    %IDC_IMAGEX    = 1004
    %ST_BAR        = 1003
    %BTN_Test      = 1002
    %LBL_LABEL1    = 1001
    '------------------
     
    CallBack Function DlgProc()
     Local hIcon As Dword, x, y As Long 
     Local rcd, rc As Rect
      Select Case As Long CbMsg
        Case %WM_INITDIALOG
     
        Case %WM_Paint                        ' deal with changed postion after resize
          GetClientRect CbHndl, rcd
          Control Send CbHndl, %ST_BAR, %SB_GETRECT, 1, Varptr(rc)
          x = rcd.nRight - (rc.nRight - rc.nLeft) + 5
          y = rcd.nBottom - (rc.nBottom - rc.nTop) + 2
          MoveWindow GetDlgItem(CbHndl, %IDC_IMAGEX), x, y, 16, 16, 0 
     
        Case %WM_COMMAND
          Select Case As Long CbCtl
            Case %BTN_Test
              If CbCtlMsg = %BN_CLICKED Or CbCtlMsg = 1 Then
                ' Load from .ani file
                  hIcon = LoadImage(%NULL, "c:\Windows\cursors\hand.ani", %IMAGE_ICON, 16, 16, %LR_LOADFROMFILE)
                    ' Load from animated icon in resource? Un-Rem next line
     '                  hIcon = LoadImage(GetModuleHandle(""), "#100", %IMAGE_ICON, 16, 16, 0)
                  Control Send CbHndl, %IDC_IMAGEX, %STM_SETIMAGE, %IMAGE_ICON, hIcon
              End If
          End Select
     
        Case %WM_SYSCOMMAND
          If (CbWParam AND &HFFF0) = %SC_CLOSE Then
            Dialog End CbHndl
          End If
     
        Case %WM_CLOSE
     
        Case %WM_DESTROY
          DestroyIcon hIcon
      End Select
    End Function
    '------------------/DlgProc
     
    Function PBMain()
     Local hDlg  As Dword
     
      Dialog New 0, "Test", , , 200, 120, %WS_OVERLAPPEDWINDOW, To hDlg
      Control Add Label,     hDlg, %LBL_LABEL1, "Click 'Test' for Icon", 70, 15, 120, 20
      Control Add Button,    hDlg, %BTN_Test, "Test", 75, 45, 50, 15
      Control Add StatusBar, hDlg, %ST_BAR, "", 0, 0, 0, 0
      StatusBar Set Parts    hDlg, %ST_BAR, 125, 600
      StatusBar Set Text     hDlg, %ST_BAR, 1, 0, "Status Bar"  ' NB iPart is 1 based - API calls are 0 based
      Control Add ImageX,    hDlg, %IDC_IMAGEX, "", 0, 0, 0, 0, %WS_CHILD OR %WS_VISIBLE OR %SS_ICON
     
      Dialog Show Modal hDlg, Call DlgProc
     
    End Function
    '------------------/PbMain
    #IF 0
     //Sb Test.rc  Resource file
     #define RT_ANIICON 22
     
     100 22 C:\\Windows\\cursors\\hand.ani
     #ENDIF

    Leave a comment:


  • Edwin Knoppert
    replied
    I think they simply switch the image index using a thread(+updatewindow possibly)

    Leave a comment:


  • Michael Mattias
    replied
    There's a demo here somewhere of putting a progress bar in a status bar.

    But basically that just reduces to creating a child window of the status bar and 'doing something' with it.

    When that child window is a progress bar control, you control it with the PBM_xxx messages or the ProgressBar_xxx macros.

    Make that window 'something' upon which you do do animation. I'm not an animation guy, but don't you just 'display' an icon/animation file on that window?

    Leave a comment:


  • Andrew Lindsay
    started a topic Animations in the statusbar

    Animations in the statusbar

    How do I create an icon animation in a statusbar panel? I would like to be able to simulate something like the Mirosoft Word 'Print Job Spooling' feedback loop to the user.

    Any help appreciated.

    Best regards

    Andrew Lindsay
Working...
X