Mastering PowerBuilder

HomePrevious Lesson: Sheet Manager Services
Next Lesson: Window Resizing Service

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 and write the following code either in pfc_PostOpen or in Open 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 a Black background. When the memory goes below a threshold value(you can set the threshold using the of_SetMemThreshold() function.), the memory would be displayed with a 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 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. It also sets the date time format.
This.inv_statusbar.of_SetTimer(TRUE)
This.inv_statusbar.of_SetTimerFormat("m-d-yyyy")

The following code sets the refresh interval to 5 seconds.
This.inv_statusbar.of_SetTimerInterval(10)

If you have designed an object to display on the statusbar, you can ask PFC to use your object by registering it, i.e., you need to call the of_Register() function.
HomePrevious Lesson: Sheet Manager Services
Next Lesson: Window Resizing Service