www.pudn.com > tinywidget.rar > progresstest.c


#include<stdio.h>
#include "../include/tnWidgets.h"
TN_WIDGET *window1,*button2,*window5,*pbar;
int created;
void u_func3(TN_WIDGET *button,DATA_POINTER ptr)
{
tnSetEnabled(pbar,0);
if(TN_ISVISIBLE(pbar))
tnSetVisible(pbar,0);
else
tnSetVisible(pbar,1);
return;
}


void u_func1(TN_WIDGET *button,DATA_POINTER ptr)
{

static float vl=0;
vl+=20;
printf("\nin testp: >f",vl);
printf("Push Button Clicked \n");
tnProgressBarUpdate(pbar,vl);
// tnDestroyWidget(window1);
return;
}

int main(int argc,char **argv)
{

TN_WIDGET *main_widget,*button1,*button3,*label1;

main_widget=tnAppInitialize(argc,argv);
window1=tnCreateWidget(TN_WINDOW,main_widget,50,50,TN_HEIGHT,300,TN_WIDTH,400,TN_CAPTION,"Window",TN_APPWIN,1,TN_END);
button1=tnCreateWidget(TN_BUTTON,window1,50,50,TN_WIDTH, 100,TN_HEIGHT, 40,TN_FONTNAME,"arial", TN_CAPTION,"Ok",TN_END);
button3=tnCreateWidget(TN_BUTTON,window1,200,50,40,TN_CAPTION, "Hide Me :)",TN_END);
label1=tnCreateWidget(TN_LABEL,window1,10,160,TN_CAPTION,"Label",TN_END);
tnRegisterCallBack(button1,CLICKED,u_func1,NULL);
tnRegisterCallBack(button3,CLICKED,u_func3,NULL);
pbar=tnCreateWidget(TN_PROGRESSBAR,window1,100,200,TN_FILLCOLOR,GR_RGB(100,100,225),TN_WIDTH,200,TN_END);
tnMainLoop();
return 0;
}