Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: gui

Subject: gui

From: Andrea Schmidt

Date: 31 Jul, 2007 07:43:01

Message: 1 of 3

Hello,

I have a gui and I want to open a calender with a pushbutton to choose a
date. For choosing a file there is "uigetdir". Is there something like this
for choosing a date?
I hope you understand what I want.

Thanks for your help.
Andrea


Subject: gui

From: rodney.thomson@gmail.com

Date: 31 Jul, 2007 01:33:11

Message: 2 of 3

On Jul 31, 1:43 pm, "Andrea Schmidt"
<external.Andrea.Schm...@de.bosch.com> wrote:
> Hello,
>
> I have a gui and I want to open a calender with a pushbutton to choose a
> date. For choosing a file there is "uigetdir". Is there something like this
> for choosing a date?
> I hope you understand what I want.
>
> Thanks for your help.
> Andrea

Using GUIDE you can add the Microsoft Office Calendar Active X control
(assuming you have Office installed?).

Then you can query the day, month and year from this...

The best option would be to have a sub GUI that just contains the
activex calendar, and its output function (ie you close it) returns
the date that the calendar contained when it was closed (you'll see
what I mean when you play with it)

Subject: gui

From: us

Date: 31 Jul, 2007 08:36:16

Message: 3 of 3

Andrea Schmidt:
<SNIP looking for a date-picker

one of the solutions is outlined below...
copy/paste the snippet into <uidate.m> and run it at the command prompt...

us

%UIDATE date selection dialog box
% lets the user select a date
% from a calendar
%SYNTAX
% DATE = UIDATE
function sd=uidate
if ~ispc
     disp('only runs on PCs');
     sd='';
     return;
end
     fh=figure;
     fp=get(fh,'position');
     set(fh,...
           'position',[fp(1:2),340,370],...
           'numbertitle','off',...
           'name','pick a date',...
           'menubar','none',...
           'toolbar','none');
     dh=actxcontrol('mscal.Calendar',...
                    [20,20,300,300],fh);
     uh=uicontrol;
     set(uh,...
         'position',[20,330,300,30],...
         'fontname','arial',...
         'fontsize',10,...
         'string','exit and return selected date',...
         'callback',@cb);
     waitfor(uh);
     sd=dh.Value;
     delete(fh);
function cb(h,e)
     delete(h);

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
uicontrol us 31 Jul, 2007 04:42:19
actxcontrol us 31 Jul, 2007 04:42:19
activex us 31 Jul, 2007 04:42:19
calendar us 31 Jul, 2007 04:40:24
code us 31 Jul, 2007 04:40:24
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics