guides:programming:programmers_reference_manual:displaying_dynamic_text_using_the_msg

Displaying Dynamic Text Using the Msg() Function

We know that OpenInsight's flexible MSG function allows you construct messages dynamically. One of its most useful features is available to the developer by using a "Gas Gauge" or "GC" type message. The Gas Gauge type message can be constructed as outlined in the MSG_EQUATES $INSERT record. A message created using the "GC" parameter will display a gas gauge, or progress bar, as part of the message.

Parameters are passed to the message and the ticks on the progress bar are updated as processing occurs. Coding it is a fairly straightforward affair as outlined in the MSG_EQUATES record. Below is a message that displays the progress of a process, allowing the user to cancel the process by pressing the Cancel button. allowing the user to cancel. The message is 500 pixels wide.

Below is sample code that calls Msg() during the processing of 100 orders, producing the message shown above.

$Insert Msg_Equates
declare function msg
*
* to display a gauge (percent bar), use the "G" type; sub-types are C (show
* cancel button) and Y (yield on each cycle):
*
orderCnt = 100
Def = ""
Def<MCAPTION$> = "Processing Orders..."
Def<MTYPE$ > = "GC"
Def<MEXTENT$> = OrderCnt
Def<MTEXTWIDTH$> = 200
MsgUp = Msg(@window, Def)
for Order = 1 to OrderCnt
gosub ProcessOrder
* update the gauge and check if cancel was pressed
while Msg(@window, MsgUp, Order, MSGINSTUPDATE$)
next Order
retval = Msg(@window, MsgUp) ;* take down the gauge
return 0
 
ProcessOrder:
*
*  Process order number "OrderCnt"
*
for i = 1 to 1000000
next i
return
  • guides/programming/programmers_reference_manual/displaying_dynamic_text_using_the_msg.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1