IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Interfaces Graphiques Discussion :

Arrêter le défilement d'images avec un pushbutton


Sujet :

Interfaces Graphiques

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2003
    Messages
    453
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2003
    Messages : 453
    Points : 74
    Points
    74
    Par défaut Arrêter le défilement d'images avec un pushbutton
    Bonjour,

    J'ai un petit soucis. J'ai une interface graphique développée avec Matlab avec un pushbutton. Si l'inscription GO est inscrite dessus alors quand je clique dessus je visualise une série d'images:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    for i=1:100
          I1 = reshape(tab(i,:),[size(tab,2) size(tab,3)]);
          set(h,'visible','on');
          colormap('jet'); 
          drawnow
          pause(0.01);
    end
    Et l'inscription sur ce bouton passe à STOP avant le début de défilement des images. Du coup je voudrais qu'une fois cette inscription STOP apparait, si on appuie dessus alors le défilement s'arrête. Je pensais utiliser return mais cela n'arrête pas le défilement. Comment puis-je faire?

    Merci.

  2. #2
    Membre éclairé Avatar de tubaas
    Homme Profil pro
    Acousticien
    Inscrit en
    Août 2009
    Messages
    641
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Acousticien
    Secteur : Industrie

    Informations forums :
    Inscription : Août 2009
    Messages : 641
    Points : 825
    Points
    825
    Par défaut
    salut
    on ne sait pas très bien ce que tu fais.
    Une proposition :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    function pushbutton_callback(src, evt)
    switch get(src, 'String')
    case 'go'
    set(src, 'UserData', 'go');
    set(src, 'String', 'stop');
    %...
    for i=1:100
          I1 = reshape(tab(i,:),[size(tab,2) size(tab,3)]);
          set(h,'visible','on');
          colormap('jet'); 
          drawnow
          pause(0.01);
          if strcmpi(get(src, 'userdata'), 'stop');
             return;
          end
    end
    case 'stop'
    set(src, 'UserData', 'stop');
    set(src, 'String', 'go');
    end
    Normalement cela fonctionne si la propriété interruptible est 'on' (défaut) du fait de l'utilisation de DRAWNOW et PAUSE, non testé.

    Citation Envoyé par documentation Matlab
    How the Interruptible Property Works

    An object's Interruptible property can be either on (the default) or off.

    If theInterruptible property of the object whose callback is executing is on, the callback can be interrupted. However, it is interrupted only when it, or a function it triggers, calls drawnow, figure, getframe, pause, or waitfor. Before performing their defined tasks, these functions process any events in the event queue, including any waiting callbacks. If the executing callback, or a function it triggers, calls none of these functions, it cannot be interrupted regardless of the value of its object's Interruptible property.

    If the Interruptible property of the object whose callback is executing is off, the callback cannot be interrupted with the following exceptions. If the interrupting callback is a DeleteFcn or CreateFcn callback or a figure's CloseRequest or ResizeFcn callback, it interrupts an executing callback regardless of the value of the executing callback object's Interruptible property. These callbacks too can interrupt only when a drawnow, figure, getframe, pause, or waitfor function executes.

    The callback properties to which Interruptible can apply depend on the objects for which the callback properties are defined:

    *For figures, only callback routines defined for the ButtonDownFcn, KeyPressFcn, KeyReleaseFcn, WindowButtonDownFcn, WindowButtonMotionFcn, WindowButtonUpFcn, and WindowScrollWheelFcn are affected by the Interruptible property.

    For callbacks that can be issued continuously, such as most of the above, setting the figure's Interruptible property to 'off' might be necessary if callbacks from other objects or GUIs could fire while they are being issued. That is, do not interrupt callbacks that keep on coming if there is not a specific reason to do so.
    *For GUI components, Interruptible applies to the ButtonDownFcn, Callback, CellSelectionCallback, KeyPressFcn, SelectionChangeFcn, ClickedCallback, OffCallback, and OnCallback properties, for the components for which these properties are defined.

    To prevent continuously repeating callbacks such as the above from being interrupted, set the value of the Interruptible property of the object whose callback is repeating to 'off':

    set(hObject,'Interruptible','off');

    where hObject is the handle to the object whose callback is called continuously (for example, to load another GUIDE GUI).

Discussions similaires

  1. Mouse over avec défilement d'images
    Par Tristan33000 dans le forum jQuery
    Réponses: 3
    Dernier message: 17/04/2014, 12h32
  2. Défilement d'images avec différents navigateurs
    Par monlou dans le forum Général JavaScript
    Réponses: 6
    Dernier message: 10/10/2012, 09h58
  3. Cherche un plug-in galerie d'image avec défilement
    Par cypherchild dans le forum jQuery
    Réponses: 1
    Dernier message: 03/06/2010, 14h19
  4. défilement d'images avec arrêt du défilement si survol
    Par laurentSc dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 29/04/2010, 23h32
  5. [HTML]Défilement d'images avec <MARQUEE>
    Par arnaud_verlaine dans le forum Balisage (X)HTML et validation W3C
    Réponses: 4
    Dernier message: 03/03/2007, 11h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo