Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Pushbutton de type popupmenu(2 marcateurs dans le popupmenu)

Subject: Pushbutton de type popupmenu(2 marcateurs dans le popupmenu)

From: Sprinceana

Date: 15 Mar, 2009 14:46:01

Message: 1 of 1

I have a form with a pushbutton1,pushbutton2 and one image stored in axes1 component when I press pushbutton1 it stores me the image there.(i made already this)


The pushbutton2 I set in Property Inspector style of popupmenu.

This is how it looks pushbutton2 of style popupmenu:

http://img14.imageshack.us/img14/6991/marcateurs.png

I have 2 options on popupmenu

Mark *

Markr o (string property for pushbutton2 of style popupmenu)




What I need to do is when I do click on Mark * to mark me on axes1 with*(on mouse click).

http://img22.imageshack.us/img22/9779/marcateur1.png

When I select from pushbutton2 of style popupmenu mark o *(on mouse click).

http://img11.imageshack.us/img11/1970/marcateur2.png

I put here my code:( I don't know how to work with value propery of popupmenu.)

function test

fig = figure('MenuBar', 'none', 'Name', 'Gui12', ...
    'DoubleBuffer', 'on', 'NumberTitle', 'off', ...
    'Position', [200, 200, 600, 500]);

handles.ax = axes('ButtonDownFcn',@NewPoint,...
    'XLim', [0, 1], 'YLim', [0, 1]);

 handles.pnts(1) = line('XData', [], 'YData', [], ...
    'LineStyle','None', ...
    'Marker', '*', ... %pour le marcateur avec cercle j'utilise o
    'MarkerFaceColor', 'b', 'MarkerEdgeColor', 'b');

 handles.pnts(2) = line('XData', [], 'YData', [], ...
    'LineStyle','None', ...
    'Marker', 'o', ... %pour le marcateur avec cercle j'utilise o
    'MarkerFaceColor', 'b', 'MarkerEdgeColor', 'b');

handles.popup = uicontrol('style','popupmenu',...
    'units','normalized','position',[.05 .025 .1 .05],...
    'string',{'*' 'o'});

guidata(fig,handles)

    function NewPoint(h, eventdata)

        handles = guidata(gcbf);
        
        p = get(handles.ax, 'CurrentPoint');

        if strcmp(get(gcbf, 'SelectionType'), 'normal') %s'il a selecte le marcateur
 
            n = get(handles.popup,'value');
            
            XData = get(handles.pnts(n), 'XData'); %coordonnne X
            YData = get(handles.pnts(n), 'YData'); %coordonne Y
            XData = [XData, p(1,1)];
            YData = [YData, p(1,2)];
            set(handles.pnts(n), 'XData', XData, 'YData', YData); %configuration des %coordonnes
        end



Any help would be appreciated!

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us