SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
Programming a GUIDE
GUI
Prepared by:
Mahmoud Hikmet
Mostafa Majid
Working with Callbacks in GUIDE
How to Use the Example Code
Push Button
Toggle Button
Radio Button
Check Box
Edit Text
Slider
Topics:
List Box
Pop-Up Menu
Panel
Button Group
Menu Item
Table
Axes
Working with Callbacks in GUIDE
Working with Callbacks in GUIDE
display( 'Goodbye' );
close(gcf);
Push Button
Toggle Button
button_state = get(hObject, 'Value' );
if button_state == get(hObject, 'Max' )
display( 'down' );
elseif button_state == get(hObject, 'Min' )
display( 'up' );
end
Radio Button & Check Box
if (get(hObject, 'Value' ) == get(hObject, 'Max' ))
display( 'Selected' );
else
display( 'Not selected' );
end
Edit Text
input = get(hObject, 'String' );
display(input);
Strings
Retrieve Numeric Values
input = str2double(get(hObject, 'string' ));
if isnan(input)
errordlg( 'You must enter a numeric value' , 'Invalid Input' ,
'modal' )
uicontrol(hObject)
return
else
display(input);
end
List Box & Pop-Up Menu
items = get(hObject, 'String' );
index_selected = get(hObject, 'Value' );
item_selected = items{index_selected};
display(item_selected);
Panel
display( 'Mouse button was pressed' );
Resize the Window and Panel
By default, GUIDE GUIs cannot be resized, but you can
override this behavior by
selecting Tools > GUI Options and
setting Resize behavior to Proportional.
set(hObject, 'Units' , 'Points' )
panelSizePts = get(hObject, 'Position' );
panelHeight = panelSizePts(4);
set(hObject, 'Units' , 'normalized' );
newFontSize = 10 * panelHeight / 115;
texth = findobj( 'Tag' , 'text1' );
set(texth, 'FontSize' ,newFontSize);
Button Group
Button groups are similar to panels, but they also manage
exclusive selection of radio buttons and toggle buttons.
When a button group contains multiple radio buttons or
toggle buttons, the button group allows the end user to
select only one of them.
switch get(eventdata.NewValue,'Tag')
case 'radiobutton1'
display( 'Radio button 1' );
case 'radiobutton2'
display( 'Radio button 2' );
case 'togglebutton1'
display( 'Toggle button 1' );
case 'togglebutton2'
display( 'Toggle button 2' );
end
.
Axes & Slider
a=get(handles.slider1,'Value');
x=0:0.1:50;
y=sin(x*a);
plot(handles.axes1,x,y)
Simple Project
Design Calculator
By Mat lab
• Design the calculator
• In the button write this code
a= str2num(get(handles.edit1,'string'));
b= str2num(get(handles.edit2,'string'));
c=a+b;
set(handles.text3,'string',c);
• In the button write this code
a= str2num(get(handles.edit1,'string'));
b= str2num(get(handles.edit2,'string'));
c=a-b;
set(handles.text3,'string',c);
• In the button write this code
a= str2num(get(handles.edit1,'string'));
b= str2num(get(handles.edit2,'string'));
c=a*b;
set(handles.text3,'string',c);
• In the button write this code
a= str2num(get(handles.edit1,'string'));
b= str2num(get(handles.edit2,'string'));
c=a/b;
set(handles.text3,'string',c);
Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

The Ring programming language version 1.5.1 book - Part 62 of 180
The Ring programming language version 1.5.1 book - Part 62 of 180The Ring programming language version 1.5.1 book - Part 62 of 180
The Ring programming language version 1.5.1 book - Part 62 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 68 of 189
The Ring programming language version 1.6 book - Part 68 of 189The Ring programming language version 1.6 book - Part 68 of 189
The Ring programming language version 1.6 book - Part 68 of 189Mahmoud Samir Fayed
 
ejemplos gambas
ejemplos gambasejemplos gambas
ejemplos gambaseduann
 
Python basic Program
Python basic ProgramPython basic Program
Python basic Programnuripatidar
 
Phoenix for laravel developers
Phoenix for laravel developersPhoenix for laravel developers
Phoenix for laravel developersLuiz Messias
 
The Ring programming language version 1.5.1 book - Part 54 of 180
The Ring programming language version 1.5.1 book - Part 54 of 180The Ring programming language version 1.5.1 book - Part 54 of 180
The Ring programming language version 1.5.1 book - Part 54 of 180Mahmoud Samir Fayed
 
cafeteria info management system
cafeteria info management systemcafeteria info management system
cafeteria info management systemGaurav Subham
 
What Referential Transparency can do for you
What Referential Transparency can do for youWhat Referential Transparency can do for you
What Referential Transparency can do for youLuka Jacobowitz
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambasguestdd103d
 
Scala+swing
Scala+swingScala+swing
Scala+swingperneto
 

Was ist angesagt? (18)

H.W 2
H.W 2H.W 2
H.W 2
 
The Ring programming language version 1.5.1 book - Part 62 of 180
The Ring programming language version 1.5.1 book - Part 62 of 180The Ring programming language version 1.5.1 book - Part 62 of 180
The Ring programming language version 1.5.1 book - Part 62 of 180
 
Dbms file
Dbms fileDbms file
Dbms file
 
The Ring programming language version 1.6 book - Part 68 of 189
The Ring programming language version 1.6 book - Part 68 of 189The Ring programming language version 1.6 book - Part 68 of 189
The Ring programming language version 1.6 book - Part 68 of 189
 
Simple swing programs
Simple swing programsSimple swing programs
Simple swing programs
 
ejemplos gambas
ejemplos gambasejemplos gambas
ejemplos gambas
 
Ensayo
EnsayoEnsayo
Ensayo
 
Python basic Program
Python basic ProgramPython basic Program
Python basic Program
 
Of class2
Of class2Of class2
Of class2
 
Phoenix for laravel developers
Phoenix for laravel developersPhoenix for laravel developers
Phoenix for laravel developers
 
The Ring programming language version 1.5.1 book - Part 54 of 180
The Ring programming language version 1.5.1 book - Part 54 of 180The Ring programming language version 1.5.1 book - Part 54 of 180
The Ring programming language version 1.5.1 book - Part 54 of 180
 
cafeteria info management system
cafeteria info management systemcafeteria info management system
cafeteria info management system
 
What Referential Transparency can do for you
What Referential Transparency can do for youWhat Referential Transparency can do for you
What Referential Transparency can do for you
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
MFC Rect1
MFC Rect1MFC Rect1
MFC Rect1
 
Scala+swing
Scala+swingScala+swing
Scala+swing
 
Gambas
GambasGambas
Gambas
 
Yolygambas
YolygambasYolygambas
Yolygambas
 

Andere mochten auch

Educational system in kurdista
Educational system in kurdista Educational system in kurdista
Educational system in kurdista Mahmoud Ahmed
 
HydroElectricPower seminar
HydroElectricPower seminarHydroElectricPower seminar
HydroElectricPower seminarMahmoud Ahmed
 
Tree(Directed and undirected tree)
Tree(Directed and undirected tree)Tree(Directed and undirected tree)
Tree(Directed and undirected tree)Mahmoud Hikmet
 
Internet Protocol Routing
Internet Protocol RoutingInternet Protocol Routing
Internet Protocol RoutingMahmoud Hikmet
 
lossy compression JPEG
lossy compression JPEGlossy compression JPEG
lossy compression JPEGMahmoud Hikmet
 

Andere mochten auch (7)

Educational system in kurdista
Educational system in kurdista Educational system in kurdista
Educational system in kurdista
 
exe in MatLab
exe  in MatLabexe  in MatLab
exe in MatLab
 
Google adsense
Google adsenseGoogle adsense
Google adsense
 
HydroElectricPower seminar
HydroElectricPower seminarHydroElectricPower seminar
HydroElectricPower seminar
 
Tree(Directed and undirected tree)
Tree(Directed and undirected tree)Tree(Directed and undirected tree)
Tree(Directed and undirected tree)
 
Internet Protocol Routing
Internet Protocol RoutingInternet Protocol Routing
Internet Protocol Routing
 
lossy compression JPEG
lossy compression JPEGlossy compression JPEG
lossy compression JPEG
 

Ähnlich wie Programming a guide gui

import java.util.Scanner; import java.util.Random; public clas.pdf
import java.util.Scanner; import java.util.Random; public clas.pdfimport java.util.Scanner; import java.util.Random; public clas.pdf
import java.util.Scanner; import java.util.Random; public clas.pdfannaipowerelectronic
 
011 more swings_adv
011 more swings_adv011 more swings_adv
011 more swings_advChaimaa Kabb
 
import javax.swing.; import java.awt.; import java.awt.event..pdf
import javax.swing.; import java.awt.; import java.awt.event..pdfimport javax.swing.; import java.awt.; import java.awt.event..pdf
import javax.swing.; import java.awt.; import java.awt.event..pdfarwholesalelors
 
Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intentadmin220812
 
Chapter 03 game input
Chapter 03 game inputChapter 03 game input
Chapter 03 game inputboybuon205
 
Java ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfJava ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfatulkapoor33
 
Extracting ui Design - part 5 - transcript.pdf
Extracting ui Design - part 5 - transcript.pdfExtracting ui Design - part 5 - transcript.pdf
Extracting ui Design - part 5 - transcript.pdfShaiAlmog1
 
Creating a Facebook Clone - Part XVI.pdf
Creating a Facebook Clone - Part XVI.pdfCreating a Facebook Clone - Part XVI.pdf
Creating a Facebook Clone - Part XVI.pdfShaiAlmog1
 
UI Design From Scratch - Part 5.pdf
UI Design From Scratch - Part 5.pdfUI Design From Scratch - Part 5.pdf
UI Design From Scratch - Part 5.pdfShaiAlmog1
 
Gui programming a review - mixed content
Gui programming   a review - mixed contentGui programming   a review - mixed content
Gui programming a review - mixed contentYogesh Kumar
 
UI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdfUI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdfShaiAlmog1
 
1) Write a shortsnippetofcodethatcreates a J Panel objectcalled p1, .pdf
1) Write a shortsnippetofcodethatcreates a J Panel objectcalled p1, .pdf1) Write a shortsnippetofcodethatcreates a J Panel objectcalled p1, .pdf
1) Write a shortsnippetofcodethatcreates a J Panel objectcalled p1, .pdfoptokunal1
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSencha
 
Initial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdfInitial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdfShaiAlmog1
 
Creating an Uber Clone - Part V - Transcript.pdf
Creating an Uber Clone - Part V - Transcript.pdfCreating an Uber Clone - Part V - Transcript.pdf
Creating an Uber Clone - Part V - Transcript.pdfShaiAlmog1
 
Creating an Uber Clone - Part V.pdf
Creating an Uber Clone - Part V.pdfCreating an Uber Clone - Part V.pdf
Creating an Uber Clone - Part V.pdfShaiAlmog1
 

Ähnlich wie Programming a guide gui (20)

import java.util.Scanner; import java.util.Random; public clas.pdf
import java.util.Scanner; import java.util.Random; public clas.pdfimport java.util.Scanner; import java.util.Random; public clas.pdf
import java.util.Scanner; import java.util.Random; public clas.pdf
 
ch20.pptx
ch20.pptxch20.pptx
ch20.pptx
 
011 more swings_adv
011 more swings_adv011 more swings_adv
011 more swings_adv
 
import javax.swing.; import java.awt.; import java.awt.event..pdf
import javax.swing.; import java.awt.; import java.awt.event..pdfimport javax.swing.; import java.awt.; import java.awt.event..pdf
import javax.swing.; import java.awt.; import java.awt.event..pdf
 
Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intent
 
Chapter 03 game input
Chapter 03 game inputChapter 03 game input
Chapter 03 game input
 
Java ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfJava ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdf
 
AWT.pptx
AWT.pptxAWT.pptx
AWT.pptx
 
Extracting ui Design - part 5 - transcript.pdf
Extracting ui Design - part 5 - transcript.pdfExtracting ui Design - part 5 - transcript.pdf
Extracting ui Design - part 5 - transcript.pdf
 
Creating a Facebook Clone - Part XVI.pdf
Creating a Facebook Clone - Part XVI.pdfCreating a Facebook Clone - Part XVI.pdf
Creating a Facebook Clone - Part XVI.pdf
 
UI Design From Scratch - Part 5.pdf
UI Design From Scratch - Part 5.pdfUI Design From Scratch - Part 5.pdf
UI Design From Scratch - Part 5.pdf
 
Gui programming a review - mixed content
Gui programming   a review - mixed contentGui programming   a review - mixed content
Gui programming a review - mixed content
 
UI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdfUI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdf
 
1) Write a shortsnippetofcodethatcreates a J Panel objectcalled p1, .pdf
1) Write a shortsnippetofcodethatcreates a J Panel objectcalled p1, .pdf1) Write a shortsnippetofcodethatcreates a J Panel objectcalled p1, .pdf
1) Write a shortsnippetofcodethatcreates a J Panel objectcalled p1, .pdf
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
 
Initial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdfInitial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdf
 
Awt components
Awt componentsAwt components
Awt components
 
Codes.docx
Codes.docxCodes.docx
Codes.docx
 
Creating an Uber Clone - Part V - Transcript.pdf
Creating an Uber Clone - Part V - Transcript.pdfCreating an Uber Clone - Part V - Transcript.pdf
Creating an Uber Clone - Part V - Transcript.pdf
 
Creating an Uber Clone - Part V.pdf
Creating an Uber Clone - Part V.pdfCreating an Uber Clone - Part V.pdf
Creating an Uber Clone - Part V.pdf
 

Kürzlich hochgeladen

High-Quality Faux Embroidery Services | Cre8iveSkill
High-Quality Faux Embroidery Services | Cre8iveSkillHigh-Quality Faux Embroidery Services | Cre8iveSkill
High-Quality Faux Embroidery Services | Cre8iveSkillCre8iveskill
 
Design mental models for managing large-scale dbt projects. March 21, 2024 in...
Design mental models for managing large-scale dbt projects. March 21, 2024 in...Design mental models for managing large-scale dbt projects. March 21, 2024 in...
Design mental models for managing large-scale dbt projects. March 21, 2024 in...Ed Orozco
 
WCM Branding Agency | 210519 - Portfolio Review (F&B) -s.pptx
WCM Branding Agency | 210519 - Portfolio Review (F&B) -s.pptxWCM Branding Agency | 210519 - Portfolio Review (F&B) -s.pptx
WCM Branding Agency | 210519 - Portfolio Review (F&B) -s.pptxHasan S
 
Khushi sharma undergraduate portfolio...
Khushi sharma undergraduate portfolio...Khushi sharma undergraduate portfolio...
Khushi sharma undergraduate portfolio...khushisharma298853
 
Designing for privacy: 3 essential UX habits for product teams
Designing for privacy: 3 essential UX habits for product teamsDesigning for privacy: 3 essential UX habits for product teams
Designing for privacy: 3 essential UX habits for product teamsBlock Party
 
UI UX Process for SaaS Product Design Success
UI UX Process for SaaS Product Design SuccessUI UX Process for SaaS Product Design Success
UI UX Process for SaaS Product Design SuccessThink 360 Studio
 
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024Ted Drake
 
Models of Disability - an overview by Marno Retief & Rantoa Letšosa
Models of Disability - an overview by Marno Retief & Rantoa LetšosaModels of Disability - an overview by Marno Retief & Rantoa Letšosa
Models of Disability - an overview by Marno Retief & Rantoa Letšosaannemarleenolthof1
 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Barbara Rakovska
AMBER GRAIN EMBROIDERY | Growing folklore elements | Barbara RakovskaAMBER GRAIN EMBROIDERY | Growing folklore elements | Barbara Rakovska
AMBER GRAIN EMBROIDERY | Growing folklore elements | Barbara RakovskaBarusRa
 
Construction Documents Checklist before Construction
Construction Documents Checklist before ConstructionConstruction Documents Checklist before Construction
Construction Documents Checklist before ConstructionResDraft
 
Create Funeral Invites Online @ feedvu.com
Create Funeral Invites Online @ feedvu.comCreate Funeral Invites Online @ feedvu.com
Create Funeral Invites Online @ feedvu.comjakyjhon00
 
LRFD Bridge Design Specifications-AASHTO (2014).pdf
LRFD Bridge Design Specifications-AASHTO (2014).pdfLRFD Bridge Design Specifications-AASHTO (2014).pdf
LRFD Bridge Design Specifications-AASHTO (2014).pdfHctorFranciscoSnchez1
 
Math Group 3 Presentation OLOLOLOLILOOLLOLOL
Math Group 3 Presentation OLOLOLOLILOOLLOLOLMath Group 3 Presentation OLOLOLOLILOOLLOLOL
Math Group 3 Presentation OLOLOLOLILOOLLOLOLkenzukiri
 
The future of UX design support tools - talk Paris March 2024
The future of UX design support tools - talk Paris March 2024The future of UX design support tools - talk Paris March 2024
The future of UX design support tools - talk Paris March 2024Alan Dix
 
How to use Ai for UX UI Design | ChatGPT
How to use Ai for UX UI Design | ChatGPTHow to use Ai for UX UI Design | ChatGPT
How to use Ai for UX UI Design | ChatGPTThink 360 Studio
 
Unlocking Conversion_ The Art of Turning Visitors into Loyal Customers.pdf
Unlocking Conversion_ The Art of Turning Visitors into Loyal Customers.pdfUnlocking Conversion_ The Art of Turning Visitors into Loyal Customers.pdf
Unlocking Conversion_ The Art of Turning Visitors into Loyal Customers.pdfIBM
 
UX Conference on UX Research Trends in 2024
UX Conference on UX Research Trends in 2024UX Conference on UX Research Trends in 2024
UX Conference on UX Research Trends in 2024mikailaoh
 
Embroidery design from embroidery magazine
Embroidery design from embroidery magazineEmbroidery design from embroidery magazine
Embroidery design from embroidery magazineRivanEleraki
 

Kürzlich hochgeladen (18)

High-Quality Faux Embroidery Services | Cre8iveSkill
High-Quality Faux Embroidery Services | Cre8iveSkillHigh-Quality Faux Embroidery Services | Cre8iveSkill
High-Quality Faux Embroidery Services | Cre8iveSkill
 
Design mental models for managing large-scale dbt projects. March 21, 2024 in...
Design mental models for managing large-scale dbt projects. March 21, 2024 in...Design mental models for managing large-scale dbt projects. March 21, 2024 in...
Design mental models for managing large-scale dbt projects. March 21, 2024 in...
 
WCM Branding Agency | 210519 - Portfolio Review (F&B) -s.pptx
WCM Branding Agency | 210519 - Portfolio Review (F&B) -s.pptxWCM Branding Agency | 210519 - Portfolio Review (F&B) -s.pptx
WCM Branding Agency | 210519 - Portfolio Review (F&B) -s.pptx
 
Khushi sharma undergraduate portfolio...
Khushi sharma undergraduate portfolio...Khushi sharma undergraduate portfolio...
Khushi sharma undergraduate portfolio...
 
Designing for privacy: 3 essential UX habits for product teams
Designing for privacy: 3 essential UX habits for product teamsDesigning for privacy: 3 essential UX habits for product teams
Designing for privacy: 3 essential UX habits for product teams
 
UI UX Process for SaaS Product Design Success
UI UX Process for SaaS Product Design SuccessUI UX Process for SaaS Product Design Success
UI UX Process for SaaS Product Design Success
 
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
 
Models of Disability - an overview by Marno Retief & Rantoa Letšosa
Models of Disability - an overview by Marno Retief & Rantoa LetšosaModels of Disability - an overview by Marno Retief & Rantoa Letšosa
Models of Disability - an overview by Marno Retief & Rantoa Letšosa
 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Barbara Rakovska
AMBER GRAIN EMBROIDERY | Growing folklore elements | Barbara RakovskaAMBER GRAIN EMBROIDERY | Growing folklore elements | Barbara Rakovska
AMBER GRAIN EMBROIDERY | Growing folklore elements | Barbara Rakovska
 
Construction Documents Checklist before Construction
Construction Documents Checklist before ConstructionConstruction Documents Checklist before Construction
Construction Documents Checklist before Construction
 
Create Funeral Invites Online @ feedvu.com
Create Funeral Invites Online @ feedvu.comCreate Funeral Invites Online @ feedvu.com
Create Funeral Invites Online @ feedvu.com
 
LRFD Bridge Design Specifications-AASHTO (2014).pdf
LRFD Bridge Design Specifications-AASHTO (2014).pdfLRFD Bridge Design Specifications-AASHTO (2014).pdf
LRFD Bridge Design Specifications-AASHTO (2014).pdf
 
Math Group 3 Presentation OLOLOLOLILOOLLOLOL
Math Group 3 Presentation OLOLOLOLILOOLLOLOLMath Group 3 Presentation OLOLOLOLILOOLLOLOL
Math Group 3 Presentation OLOLOLOLILOOLLOLOL
 
The future of UX design support tools - talk Paris March 2024
The future of UX design support tools - talk Paris March 2024The future of UX design support tools - talk Paris March 2024
The future of UX design support tools - talk Paris March 2024
 
How to use Ai for UX UI Design | ChatGPT
How to use Ai for UX UI Design | ChatGPTHow to use Ai for UX UI Design | ChatGPT
How to use Ai for UX UI Design | ChatGPT
 
Unlocking Conversion_ The Art of Turning Visitors into Loyal Customers.pdf
Unlocking Conversion_ The Art of Turning Visitors into Loyal Customers.pdfUnlocking Conversion_ The Art of Turning Visitors into Loyal Customers.pdf
Unlocking Conversion_ The Art of Turning Visitors into Loyal Customers.pdf
 
UX Conference on UX Research Trends in 2024
UX Conference on UX Research Trends in 2024UX Conference on UX Research Trends in 2024
UX Conference on UX Research Trends in 2024
 
Embroidery design from embroidery magazine
Embroidery design from embroidery magazineEmbroidery design from embroidery magazine
Embroidery design from embroidery magazine
 

Programming a guide gui

  • 1. Programming a GUIDE GUI Prepared by: Mahmoud Hikmet Mostafa Majid
  • 2. Working with Callbacks in GUIDE How to Use the Example Code Push Button Toggle Button Radio Button Check Box Edit Text Slider Topics: List Box Pop-Up Menu Panel Button Group Menu Item Table Axes
  • 5. display( 'Goodbye' ); close(gcf); Push Button Toggle Button button_state = get(hObject, 'Value' ); if button_state == get(hObject, 'Max' ) display( 'down' ); elseif button_state == get(hObject, 'Min' ) display( 'up' ); end
  • 6. Radio Button & Check Box if (get(hObject, 'Value' ) == get(hObject, 'Max' )) display( 'Selected' ); else display( 'Not selected' ); end
  • 7. Edit Text input = get(hObject, 'String' ); display(input); Strings Retrieve Numeric Values input = str2double(get(hObject, 'string' )); if isnan(input) errordlg( 'You must enter a numeric value' , 'Invalid Input' , 'modal' ) uicontrol(hObject) return else display(input); end
  • 8. List Box & Pop-Up Menu items = get(hObject, 'String' ); index_selected = get(hObject, 'Value' ); item_selected = items{index_selected}; display(item_selected);
  • 9. Panel display( 'Mouse button was pressed' ); Resize the Window and Panel By default, GUIDE GUIs cannot be resized, but you can override this behavior by selecting Tools > GUI Options and setting Resize behavior to Proportional. set(hObject, 'Units' , 'Points' ) panelSizePts = get(hObject, 'Position' ); panelHeight = panelSizePts(4); set(hObject, 'Units' , 'normalized' ); newFontSize = 10 * panelHeight / 115; texth = findobj( 'Tag' , 'text1' ); set(texth, 'FontSize' ,newFontSize);
  • 10. Button Group Button groups are similar to panels, but they also manage exclusive selection of radio buttons and toggle buttons. When a button group contains multiple radio buttons or toggle buttons, the button group allows the end user to select only one of them. switch get(eventdata.NewValue,'Tag') case 'radiobutton1' display( 'Radio button 1' ); case 'radiobutton2' display( 'Radio button 2' ); case 'togglebutton1' display( 'Toggle button 1' ); case 'togglebutton2' display( 'Toggle button 2' ); end .
  • 13. • Design the calculator
  • 14. • In the button write this code a= str2num(get(handles.edit1,'string')); b= str2num(get(handles.edit2,'string')); c=a+b; set(handles.text3,'string',c); • In the button write this code a= str2num(get(handles.edit1,'string')); b= str2num(get(handles.edit2,'string')); c=a-b; set(handles.text3,'string',c);
  • 15. • In the button write this code a= str2num(get(handles.edit1,'string')); b= str2num(get(handles.edit2,'string')); c=a*b; set(handles.text3,'string',c); • In the button write this code a= str2num(get(handles.edit1,'string')); b= str2num(get(handles.edit2,'string')); c=a/b; set(handles.text3,'string',c);