How to Callback Function After Creating a GUI

  • Thread starter Thread starter cherish_girl
  • Start date Start date
  • Tags Tags
    Gui
Click For Summary

Discussion Overview

The discussion revolves around how to implement a callback function for a GUI that performs addition when a button is clicked. Participants are exploring various programming environments and seeking clarity on how to connect GUI elements to functions, particularly in the context of adding two numbers.

Discussion Character

  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • One participant asks how to link a button in a GUI to a function that performs addition, specifically requesting detailed guidance.
  • Another participant suggests a code snippet for assigning the result of a function to a button's text property, but does not specify the programming language.
  • A participant requests clarification on the programming language being used, indicating that the approach may vary based on the environment (C#/.NET, Java, Qt, C++).
  • There are repeated inquiries about the basics of GUI programming, with one participant expressing a lack of understanding of fundamental concepts like printing text to the screen.
  • Another participant mentions a specific website that provides guidance on adding two numbers using a GUI but notes issues with obtaining correct results, suggesting that the implementation may not be working as intended.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the specific programming language or the correct method for implementing the callback function. There is a general acknowledgment of the need for more foundational knowledge in GUI programming among some participants.

Contextual Notes

There are limitations in the discussion regarding the lack of clarity on the programming language and the specific GUI framework being used, which affects the applicability of the advice given. Additionally, some participants express uncertainty about basic programming concepts.

Who May Find This Useful

Individuals new to GUI programming, particularly those interested in learning how to implement callback functions in various programming environments.

cherish_girl
Messages
4
Reaction score
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
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.
 
It would help to know whether this is C#/.NET, Java, Qt, C++ or what.
 
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.
 
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?
 
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.
 
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?
 
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:
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.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
1
Views
5K
Replies
6
Views
3K
Replies
1
Views
6K