Announcement

Collapse
No announcement yet.

Problem using img_Touched(hndl,-1)

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

  • Problem using img_Touched(hndl,-1)

    Hello,

    I have a problem using the function img_Touched(hndl,-1) function. I have in my code different forms. While I´m in a specific form using/programming a slider, the function returns me identifiers which correspond to other images placed in other forms at the same location.

    Any idea how to fix it?

    Thank you

    --------------------------
    Code:
    _n := img_Touched(hndl,-1)
    if(_state == TOUCH_MOVING)
    x:= touch_Get(TOUCH_GETX);
    y:= touch_Get(TOUCH_GETY);
    if(_n == iSlider1)
    posn := y - 96 ; // y - top - 8
    if (posn < 0)
    posn := 90 ; // maxvalue-minvalue
    else if (posn > 137) // height - 17)
    posn := 0 ;
    else
    posn := 90 - 90 * posn / 137 ; // max-min - (max-min) * posn / (height-17)
    endif
    img_SetWord(hndl, iSlider1, IMAGE_INDEX, posn);
    img_Show(hndl, iSlider1);
    endif
    endif
    --------------------------

  • #2
    Hi, and welcome to the forum!

    When using ViSi environment you would have to do everything
    manually, which includes disabling and enabling every touchable objects from other forms
    when switching between them. Meaning, it will give you more control.

    To disable a touchable object, try:
    Code:
    img_Disable(hndl, iSlidern);
    To enable again, try:
    Code:
    img_Enable(hndl, iSlidern);
    img_ClearAttributes(hndl, iSlidern, I_TOUCH_DISABLE);
    img_Show(hndl, iSlidern);

    4D-AN-00201: ViSi Form Switch
    http://www.4dsystems.com.au/appnote/4D-AN-00201/

    In summary, to change form in ViSi, you need to:
    1. disable the widgets in the current screen
    2. clear the screen or draw the desired background image
    3. show and activate the widgets of the current screen

    You need to do all of this manually when switching from one form to another.

    If it's okay with you, please upload your project file so it would be a lot easier
    for us to debug your code.

    Hope this helps and best regards,
    Sherwin
    Last edited by sherwin4D; 23rd April 2019, 06:30 PM.

    Comment


    • #3
      Thank you sherwin4D, I have already modified the code and seems working properly.

      Best regards and have a nice day

      Comment


      • #4
        Hi,

        That's great. Glad your project is now working properly. If you have other inquiries,
        we're always here to help.

        Best regards,
        Sherwin

        Comment

        Working...
        X