Announcement

Collapse
No announcement yet.

Read if a Object is hidden in MagicTouch

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

  • Read if a Object is hidden in MagicTouch

    Hi!

    I'm trying to find out on how I can read in MagicTouched if a touch is given on a visible object or on a hidden one.

    The code is:
    if (ImageTouched == iSmartGauge5)
    ActivateForm(3);
    ImageTouched := -1;
    SendReport(REPORT_EVENT,tForm,3,0);
    else if (ImageTouched == iSmartGauge6)
    ActivateForm(2);
    ImageTouched := -1;
    SendReport(REPORT_EVENT,tForm,2,0);
    else if (ImageTouched == iLed0)
    ActivateForm(1);
    ImageTouched := -1;
    SendReport(REPORT_EVENT,tForm,1,0);
    else if (ImageTouched == iLed1)
    ActivateForm(1);
    ImageTouched := -1;
    SendReport(REPORT_EVENT,tForm,1,0);
    endif

    If I change it to

    if (ImageTouched == iSmartGauge5)
    if (ReadObject(35,5) != -1)
    ActivateForm(3);
    ImageTouched := -1;
    SendReport(REPORT_EVENT,tForm,3,0);
    endif
    else if (I ....

    it will still work on the Gauge.
    What am I doing wrong?

    Thanks
    Daniel
    Last edited by dka; 14th December 2019, 05:31 AM.

  • #2
    Hi Daniel,

    Welcome to the forum!

    Can I ask what are you trying to implement here?

    By default, the output widget is not designed to accept touch input, thus you need to manually enable it using the img_ClearAttributes() command.

    Please check this forum inquiry for its proper implementation:
    Magic touch query
    https://forum.4dsystems.com.au/node/...3046#post63046

    I hope this helps.

    Best Regards,
    Kevin

    Comment


    • #3
      Hi Kevin,

      thank you vor your reply. Everything is Working Fine With the touches.

      The question is, if there is a way to read in magiccode if a object is hidden or not.
      If I do a readobject on a magicGauge that is hidden by a writeObject with —1 , the read value is 0.

      best regards
      daniel

      Comment


      • #4
        Hi Daniel,

        Thank you for your reply.
        You could use the img_GetWord to get the current frame of an object.

        Code:
         WriteObject(iSmartGauge5, 0, -1);
        print(img_GetWord(hndl, iSmartGauge5, IMAGE_INDEX));
        By writing a -1 to an object, you should also get a -1 value for the current frame.

        Best Regards,
        Kevin

        Comment

        Working...
        X