UI element

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

UI element

Octave - General mailing list
hi, i want to creare interface to input some value

i use this code:

## Create figure and panel on it
f = figure;
## Create a button (default style)
b1 = uicontrol (f, "string", "A Button", ...
                   "position", [10 10 150 40]);
## Create an edit control
e1 = uicontrol (f, "style", "edit", "string", "editable text", ...
                   "position", [10 60 300 40]);
## Create a checkbox
c1 = uicontrol (f, "style", "checkbox", "string", "a checkbox", ...
                   "position", [10 120 150 40]);

i want to get value input  
How can i get it?

Example:

https://gyazo.com/b9c9986609e987936bd44b189a2d04f4





--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: UI element

Doug Stewart-4


On Wed, Dec 18, 2019 at 1:57 PM shivax via Help list for GNU Octave <[hidden email]> wrote:
hi, i want to creare interface to input some value

i use this code:

## Create figure and panel on it
f = figure;
## Create a button (default style)
b1 = uicontrol (f, "string", "A Button", ...
                   "position", [10 10 150 40]);
## Create an edit control
e1 = uicontrol (f, "style", "edit", "string", "editable text", ...
                   "position", [10 60 300 40]);
## Create a checkbox
c1 = uicontrol (f, "style", "checkbox", "string", "a checkbox", ...
                   "position", [10 120 150 40]);

i want to get value input 
How can i get it?



Try this:

 CSTR = inputdlg ("enter a number")
 CSTR



 
Example:

https://gyazo.com/b9c9986609e987936bd44b189a2d04f4





--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html




--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: UI element

Octave - General mailing list
thank you for answer

i want similar this:

https://gyazo.com/d77c1ef2b7880579a11b32c37fbb9e3a

i put number in a, b and c  and after i touch "press "

i want to read variable a , b and c



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

RE: UI element

Tony Richardson
> -----Original Message-----
> Subject: Re: UI element
>
> thank you for answer
>
> i want similar this:
>
> https://gyazo.com/d77c1ef2b7880579a11b32c37fbb9e3a
>
> i put number in a, b and c  and after i touch "press "
>
> i want to read variable a , b and c

For the code in your original post:
   s = get(e1, 'string')
will return the edited string in the textbox.  Similarly
  v = get(c1, 'value')
will return the checkbox state( 0 or 1).   (Type "get(c1)" to see all of the checkbox properties.)

This would allow you to poll the gui elements looking for changes.   You don't usually want to use this method though.  Instead you would define a callback function that is automatically run whenever the gui element is changed.  There are several Octave GUI examples here:
http://ss2.eecs.umich.edu/matlab/ulaby_matlab.html 
That may help you get further.

Tony Richardson


Reply | Threaded
Open this post in threaded view
|

RE: UI element

Octave - General mailing list
thank you for your suggestion



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html