|
|
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Using value from EditInt
|
|
Re: Using value from EditInt [message #2935 is a reply to message #2931] |
Sun, 30 April 2006 23:52   |
 |
forlano
Messages: 1207 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
BenP wrote on Sun, 30 April 2006 21:15 | Hi,
I have tried the following but with no success
d.TicketLookupBtn <<= THISBACK1(EditTicket, d.TicketLookupBox);
How do I use what is in the edit box and pass it to my function?
|
To get the data associated with the widget myWidget you can use the operator '~'. For example a = ~myWidget as showed above.
When you need to set some value use the operator '<<='. For example:
myWidget <<= data;
In your case I think you can use
d.TicketLookupBtn <<= THISBACK1(EditTicket, ~d.TicketLookupBox);
Let us know if you resolved the problem.
Luigi
[Updated on: Sun, 30 April 2006 23:55] Report message to a moderator
|
|
|
|
|
Re: Using value from EditInt [message #2957 is a reply to message #2954] |
Mon, 01 May 2006 13:55  |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
BenP wrote on Mon, 01 May 2006 06:19 | Neither of the above examples worked I will give snippets of my code in the hope it may help.
LookupTicket() is the function which shows the lookup dialog(see first post) and EditTicket(int ticket_id) will give me a dialog to update the ticket. The ticket_id parameter must be passed to the EditTicket function so it can get data for the correct ticket.
void Helpdesk::LookupTicket()
{
WithLookupTicket<TopWindow> d;
CtrlLayout(d, "Lookup Ticket");
//This is the problem code
d.TicketLookupBtn <<= THISBACK1(EditTicket, d.TicketLookupBox);
//========================
d.Run();
}
void Helpdesk::EditTicket(int ticket_id)
{
WithEditTicket<TopWindow> d;
CtrlLayout(d, "Edit Ticket");
//Edit Ticket Code
d.Run();
}
|
Ah, I see. This is not typical solution, the problem is that still that "THISBACK1" used this way simply stores current value for EditTicket.
There are several ways how to solve this:
- use class for LookupTicket, then the EditTicker, parameterless, will be its member and you will be able to read the value of LookupTicket's LookupTicketBox as it will be the member. This is what I proposed in recent reply.
- use breaker - if you press that button, "d.Run" will be breaked and you will be able to read the value of d.TicketLookupBox and call EditTicket.
d.Breaker(d.TicketLookupBtn, 111);
for(;;) {
int c = d.Run();
if(c == 111)
EditTicket(~d.TicketLookupBox);
if(c == IDCANCEL) // close button will send this
break;
}
- you could also make EditTicket to accept a pointer to EditInt and pass that pointer using THISBACK1. This is the worst solution IMHO.
Mirek
|
|
|
Goto Forum:
Current Time: Sat Apr 26 23:21:19 CEST 2025
Total time taken to generate the page: 0.02860 seconds
|
|
|