How to Callback Function After Creating a GUI

  • Thread starter cherish_girl
  • Start date
  • Tags
    Gui
In summary: If you want, I can try to help you with that. I'm learning this language at the moment, but I can still help you.
  • #1
cherish_girl
4
0
after creating a gui ,how to call back a particular function?
for example ,if i have created a gui call for adding two numbers with one push botton named 'sum' ,so that when we click on the sum push botton ,it should display the result.the problem is how to link this push button to call the 'sum' function.


waiting for reply about how to callback the function in detail as early as possible please.
 
Technology news on Phys.org
  • #2
Well, if you're simply looking to assign the result to the the button, then some version of this:


btnSum.text = doSum(fieldA, fieldB)

btnSum is the reference to your button object, and it will have a text or label or some such property.
 
  • #3
It would help to know whether this is C#/.NET, Java, Qt, C++ or what.
 
  • #4
DaveC426913 said:
Well, if you're simply looking to assign the result to the the button, then some version of this:


btnSum.text = doSum(fieldA, fieldB)

btnSum is the reference to your button object, and it will have a text or label or some such property.

how should i give,like btnsum.text=dosum(2,3).will i get the answer if i give like this,if yes where will i get the answer?and where should i write this,i.e..,in which line in Mfile?i.e..,should i write it inpushbutton call back?please give me the exact procedure of how to run a GUI for addition of two numbersie..,how to write a program in Mfile.pleasezzz.will be waiting for ur reply.
 
  • #5
How are you learning this? It sounds like you've got a fair bit of reading ahead of you.

How are you on the basic basics?

Do you know how to simply press a button and have it print "Hello World!" on the screen?
 
  • #6
DaveC426913 said:
How are you learning this? It sounds like you've got a fair bit of reading ahead of you.

How are you on the basic basics?

Do you know how to simply press a button and have it print "Hello World!" on the screen?

sorry am neew to this topic,i don't know how to print "hello world".on the screen just by pressing a button.i need to learn form basics,this is entirely new for me.
 
  • #7
cherish_girl said:
sorry am neew to this topic,i don't know how to print "hello world".on the screen just by pressing a button.i need to learn form basics,this is entirely new for me.
But how are you learning now? Book? Class?
 
  • #8
DaveC426913 said:
But how are you learning now? Book? Class?

from net,as am new to this am unable to understand.so will u pleasezzz explain me in detail or else give me any web sites regarding gui.ill refer.i went thru a website named www.matlabgui.com.it[/URL] is clearly given about how to add two numbers ,but wen i implement the same am getting the result as some garbage value.will u please check that web site.
 
Last edited by a moderator:
  • #9
Coin said:
It would help to know whether this is C#/.NET, Java, Qt, C++ or what.

I agree, giving advices without knowing language/GUI is little bit strange. Especially if you cannot show anything or react on buttons yet.
 

1. What is a callback function in a GUI?

A callback function is a function that is passed as an argument to another function and is executed at a specific point in the code. In a GUI, a callback function is used to handle user actions, such as clicking a button or selecting an option in a drop-down menu.

2. How do I create a callback function in a GUI?

To create a callback function in a GUI, you need to define a function that will handle the specific user action, such as clicking a button. Then, you can pass this function as an argument to the appropriate widget or event handler function in your GUI library.

3. Can I use multiple callback functions in a single GUI?

Yes, you can use multiple callback functions in a single GUI. This can be useful for handling different user actions, such as clicking different buttons or selecting different options in a drop-down menu.

4. How do I know when my callback function is executed in a GUI?

You can know when your callback function is executed in a GUI by adding print statements or using debugging tools. Additionally, some GUI libraries have built-in methods for checking when a callback function is executed.

5. Is there a specific order in which callback functions are executed in a GUI?

The order in which callback functions are executed in a GUI depends on the specific implementation and the user's actions. Generally, callbacks are executed in the sequence in which they are triggered by user actions.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • Programming and Computer Science
Replies
8
Views
185
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
4
Views
331
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
4
Views
742
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top