LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the color of the progress bar after calling CreateProgressBarDialog

I like the functionality of the progress bar dialog in the Programmer's Toolbox but was a bit annoyed that the color attributes were not exposed so they could be changed.
 
So here is a bit of code I put together to do this, I hope some of you will find it useful:
 

// This struct is defined in toolbox.c but not exposed
// you will need it to access the control handle

typedef struct
{
    int panel;
    int progressIndicator;
    int cancelRequested;
    int cancelButton;
} *ProgressDlg;

int progressDlgHndl;
ProgressDlg progressDlg = 0;

progressDlgHndl = CreateProgressDialog ("Operation Completion Status",
 "Estimated Percent Complete", 0, VAL_NO_INNER_MARKERS, 0);

GetPanelAttribute (progressDlgHndl, ATTR_CALLBACK_DATA, &progressDlg);

SetCtrlAttribute (progressDlg->panel, progressDlg->progressIndicator,
 ATTR_FILL_COLOR, VAL_GREEN);

SetCtrlAttribute (progressDlg->panel, progressDlg->progressIndicator,
 ATTR_FILL_HOUSING_COLOR, VAL_LT_GRAY);

ProcessDrawEvents ();

// Do your operation and update progress...

DiscardProgressDialog (progressDlgHndl);

Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
Message 1 of 1
(3,207 Views)