Announcement

Collapse
No announcement yet.

Need to enable/disable static text or else have better fonts

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need to enable/disable static text or else have better fonts

    Using Genie Pro with Diablo. I need to change a headline on a form in runtime. I noticed someone already mentioned about the lower quality fonts in Strings vs statictext and it seems nothing can be done about this or I could have done this with the Strings objects. So my question is, can I change some text on a form using statictext? It seems that I could create several headlines of statictext objects located in the same position, then just turn each one on/off as I need it, but can't figure out how to do that. If I can't do this, what other options do I have to keep the high quality text and change text dynamically? If there is no way to do this. I'll have to copy the form 3 more times and repeat all the buttons and so on, which of course is a lot of work to just change a heading. Thanks.

  • #2
    Hi,

    You can turn Statictext ON/OFF using the ViSi-Genie Magic's WriteObject Callable Function.

    In Magic Code Insertion Point(Main Loop), you can add the line WriteObject(tStaticText,0,1); to show the statictext 0.

    I have attached a sample code for you to try.

    Hope this helps and Best Regards,
    Attached Files
    Eran

    Comment


    • #3
      Thanks. I got it working for the most part, but one issue is that when the form activates (ActivateFrom(2)), all of the text is written before I can overwrite with the text I want. So when the page shows there is a momentary flickering on the text as each statictext object gets written in the same location. Is there a way to make the text invisible before the page loads, then just write the text I want using the writeobject command? I thought i could do this with WriteObject(tStaticText,0,0) where I thought the second 0 might turn the text off before I activated the page, but that doesn't work.

      Comment


      • #4
        Also, is there a reference where I can look at everything the WriteObject() function can do to each object and what the 3rd parameter does? The WriteObject description in the Genie reference manual doesn't give too much info about this.

        Comment


        • #5
          Hi,

          Have you tried setting your contrast to 0 then activate the form and hide your statictext before setting the contrast high again? In this way, you won't be seeing the "flicker" that you have mentioned since the transition of form happened during low Contrast.

          I have attached a sample code for you and I hope that it helps. I have also included a two-second pause after form activation and before the heading first appears.

          Based on the documentation,
          Function Description Parameters Description
          WriteObject Sets the value of a Genie Object ObjectType eg tKnob
          ObjectIdx Object number, eg 0, 1
          NewVal New value, eg 123
          the third parameter is the new value that you want to set your object into. For example, if you want to set your Userbutton0 to frame 1, then the third parameter will be 1.

          Did we miss something that you can't find in this documentation?

          Also, if you just need a heading object, I think it's easier for you to use Userimages with two frames that switches frame to whichever frame you want to use. I have also included this in the first form of the sample code.

          Hope this helps and Best Regards,
          Attached Files
          Last edited by Eran; 27th April 2019, 02:20 PM.
          Eran

          Comment


          • #6
            Using the contrast method actually works quite well. The screen is blank for about 200ms or so (as the 8 statictext objects load I guess) before the screen appears, so I tried taking this one step further by doing this:

            var i;
            for(i:=11;i>-1;i--)
            gfx_Contrast(i);
            pause(5);
            next
            ActivateForm(2);
            //activate the headlines for this program
            WriteObject(tStaticText, 8, 1); //turn on headline 8
            WriteObject(tStaticText, 12, 1); //turn on headline 12
            for(i:=1;i<15;i++)
            gfx_Contrast(i);
            pause(5);
            next

            And this works great. The pause is now unnoticable since the fade covers that up and makes it look like that's what's suppose to happen. So I'm sticking with this.

            I was going to try the image thing you suggested earlier since I thought that would be the only way to keep the nice looking text, but that would involve creating the text in a vector drawing program and so I like this method better. Unless of course there is a way to save the statictext I already created and call those up as images or something.

            With regard to the WriteObject info: Some objects are obvious like leds and so on, but objects like statictext, it's not clear what the 3rd parameter does. It seems it puts the text on top of a layer of text, but originally I thought it was to turn the text on and off (1 and 0) but obviously thats not what it does.

            Also, I don't know what the t and i before Knob and Statictext for example is or when I should use one or the other.

            Thanks for the help!

            Comment


            • #7
              Hi,

              The third parameter of the WriteObject function writes a new value to a certain object. With certain objects, the newval represents the frame number that the WriteObject is setting the object to. In ViSi-Genie Magic, upon writing a new value, it will also automatically show the object.
              For single frame objects (i.e. statictext), any value would make it appear since the function is writing to this object.
              You may read this forum post to know about the “I” and “t” https://forum.4dsystems.com.au/node/...2254#post62254

              Hope this helps and Best Regards,
              Eran

              Comment

              Working...
              X