Announcement

Collapse
No announcement yet.

Read Value from InternalKnob

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

  • Read Value from InternalKnob

    Hello,

    When I am programming in 4DGL, using visi-genie magic, to send value to the output object I use function: WriteObject(object, index, value), but I can't find similar function to directly read value from for example Internal Knob.

    Regards
    Chris

  • #2
    Hi Kolin,

    Yes, there is no function to manually read the value of an Internal Knob from within your additional code.

    Instead of reading the value, you can create a MagicEvent that you can link to the OnChanged event of your Internal Knob.

    This way you can process the new value or save it to a global variable for later use.

    I hope this helps.

    Best Regards
    Juniel Cruz

    Comment


    • #3
      Hi, thanks for help. Magic event is a very good option to solve my problem and many others.
      Staying in Visi Genie Magic is there any possibility to disable chosen buttons or sliders. For example I have two operating modes: automatic and manual. When automatic is selected it would be helpful to prevent from accidental touching some of the sliders.

      Comment


      • #4
        Hi Kolin,

        You can try using the functions:

        Code:
        img_SetAttributes(hndl, iSliderN, I_TOUCH_DISABLE); // disable touch
        img_ClearAttributes(hndl, iSliderN, I_TOUCH_DISABLE); // enable touch
        where N is the slider number.

        Keep in mind that when a Form activates, it resets the touch settings to default. So all touch widgets in the activated form will be reenabled. You can disable them again in a MagicCode in PostActivateForm.

        Best Regards
        Juniel Cruz

        Comment


        • #5
          Hi, I tried to use this function in PostActivateForm but during compilation I received errors. Details are below.
          Errors does't appear if I chose insert point as Main Loop, but iSwitch are still enable.

          Regards

          Click image for larger version  Name:	error.jpg Views:	2 Size:	197.3 KB ID:	74568
          Last edited by Kolin; 17 December 2020, 09:15 PM.

          Comment


          • #6
            Hi,

            The switch you are using is an Internal widget so it is handled a little different. Can you please try this.

            widget_Disable(wp, iISwitch0);

            wp is a genie handle used for Internal / Inherent widgets

            Best regards

            Paul

            Comment


            • #7
              Hello,

              when I use
              widget_Disable(wp, iISwitch0);
              or widget_Disable(wp, iSwitch0);
              or widget_Disable(wp, tiSwitch0);
              in postActiveForm section I still receive the same error as previous.

              Regards

              Comment


              • #8
                Hi,

                Thats odd. I tried it in Post Activate form and it was fine. I've attached and example using the same method, could you please try it and let me know the result.

                Best regards

                Paul
                Attached Files

                Comment


                • #9
                  Ok, I noticed my mistake, the problem was with second letter in 'iISwitch0', in your example i noticed it is a capital 'i' not small 'L'. Thanks a lot for help. Now it works fine.

                  Best Regards

                  Comment

                  Working...
                  X