control progress bar from library proc

control progress bar from library proc

Post by Gary Spinell » Fri, 25 Apr 1997 04:00:00



I'm like to be able to control a progress bar object on a form from a
library procedure, but I can't quite figure out how to attach to a
UIObject from a library procedure on a form that is already open. I've
tried passing the UIObject to the library procedure by reference, that
gives me a compile error.  I've also tried opening the form and then
attaching to the progress bar object, but that opens another copy of the
form.  When I try to attach to the form from the library and then attach
to the progress bar, I get attached to the pushbutton the procedure was
called from, not the progress bar.

 
 
 

control progress bar from library proc

Post by Mark De Rever » Sat, 26 Apr 1997 04:00:00


Gary,

Assuming you are trying to use your own version of a progress bar, what you
are describing should work just fine.  I just put together the following code
as an example:

The code in the library method:

   method myProgressBar(const progressBarUIO UIObject)
   var
      i SmallInt
   endVar

   progressBarUIO'text = blank()
   ;;; obviously the number of loops would be from a passed variable based
   ;;; on some condition in your calling form.
   for i from 1 to 5
      ;;; in the wingdings font 'n' is a solid box.
      progressBarUIO'text = progressBarUIO'text + "n"
   endFor

   endMethod

The code on a pushbutton in your form:
   method pushButton(var eventInfo Event)
   var
      myProgressBarUIO   UIObject
   endVar

   ;;; myProgressBarTXT is the text field that is being used as a
   ;;; progress bar.
   if myProgressBarUIO.attach(myProgressBarTXT) then
      myLib.myProgressBar(myProgressBarUIO)
   endIf

   endMethod

I hope this helps.

  - Mark


> I'm like to be able to control a progress bar object on a form from a
> library procedure, but I can't quite figure out how to attach to a
> UIObject from a library procedure on a form that is already open. I've
> tried passing the UIObject to the library procedure by reference, that
> gives me a compile error.  I've also tried opening the form and then
> attaching to the progress bar object, but that opens another copy of the
> form.  When I try to attach to the form from the library and then attach
> to the progress bar, I get attached to the pushbutton the procedure was
> called from, not the progress bar.


 
 
 

control progress bar from library proc

Post by Daniel A. Morga » Wed, 30 Apr 1997 04:00:00


Quote:> I'm like to be able to control a progress bar object on a form from a
> library procedure, but I can't quite figure out how to attach to a
> UIObject from a library procedure on a form that is already open.

1. attach to the form with a form variable.

   formVar.attach("Form's Name")

2. Set the value by referring to the object directly.

   formVAr.uiObjectName.value = some value

You do NOT attach to the progress bar . . . you just assign it a value.

Daniel A. Morgan