Mastering PowerBuilder

HomePrevious Lesson: Course 3:: Session 24 :: Page 430
Next Lesson: Course 3:: Session 24 :: Page 450
Statusbar Service

By using the PFC Statusbar services, you can display the current date time, total memory, free memory ( user and GDI ). You can ask the PFC to refresh all those details at certain intervals. Typically, you use this service from the w_frame window. To use the Statusbar service, first you need to turn on the service as shown below (All the code explained below is for the pfc_PostOpen event.):

this.of_SetStatusBar(TRUE)

Now, let’s ask PFC to display the total available memory.

This.inv_statusbar.of_SetMem( TRUE )

If you would like to increase the memory display area width, call the of_SetMemWidth() function.

This.inv_statusbar.of_SetMemWidth( 400 )

By default, the memory value is displayed on the Statusbar with the Black background. When the memory goes below the threshold (you can set the threshold using the of_SetMemThreshold() function.), the memory would be displayed with the red color background.

// Set the threshold to 1 Mg.

that This.inv_statusbar.of_SetMemThreshold( 1048576 )

The following code is for the user memory.

This.inv_statusbar.of_SetUserThreshold( -2 )
This.inv_statusbar.of_SetUser( TRUE )
This.inv_statusbar.of_SetUserWidth( 400 )

The following code is for the GDI.

This.inv_statusbar.of_SetGDIThreshold( -2 )
This.inv_statusbar.of_SetGDI( TRUE )
This.inv_statusbar.of_SetGDIWidth( 400 )

You can also ask the PFC to use different border for the Statusbar display service.

This.inv_statusbar.of_SetBorderType( 3 )

The following code asks PFC to display the date time on the Statusbar. This code also sets the date time format.

This.inv_statusbar.of_SetTimer( TRUE )
This.inv_statusbar.of_SetTimerFormat( "m-d-yyyy" )

The following code sets refresh interval to 5 seconds.

This.inv_statusbar.of_SetTimerInterval( 10 )

If you have designed a different object to display on the statubar, you can ask the PFC to use your object by registering your object, i.e., you need to call of_Register() function.

HomePrevious Lesson: Course 3:: Session 24 :: Page 430
Next Lesson: Course 3:: Session 24 :: Page 450