|
|
Home » Community » Newbie corner » Message from the system.
Message from the system. [message #27109] |
Fri, 25 June 2010 16:56  |
281264
Messages: 272 Registered: June 2010 Location: Spain
|
Experienced Member |
|
|
Annoying message after application termination
Hi,
When I terminate a compiled application this system message is displayed (see attached file). It seems to be related with memory allocation or pointers. Note: the message is in Spanish and its translation is something like:
”The instruction in “…” refers to memory “…””. Memory can not be read.”
Any idea what is it?
Thanks,
Javier
|
|
|
|
|
Re: Message from the system. [message #27122 is a reply to message #27121] |
Sat, 26 June 2010 23:28   |
|
281264 wrote on Sat, 26 June 2010 22:07 | Hi,
I am attaching the files of the application in question (please remember that the purpose is to get familiar with U++). The application is very simple: open a dialog by clicking the button in the TopWindow; then type two (double) values in the Edit Fields; then press OK button , close dialog and then compute the multiplication and then show the outcome in the EditField in the TopWindow.
The idea is to practice with dialogs: how to create them, how to transfer values to the TopWindow, etc.
You will see that I still have no idea about how to position the widgets in the dialog, therefore the layout in the dialog is rubbish.
Taking advantage of your help, please allow me to ask some questions:
1.- How to pass the values from the EditFields in the dialog to the TopWindow; so far I have declared public the variables in the dialog so they can be accessed;
2.- How a string captured by a EditField can be converted to a numerical value (let us say double) and vice versa;
3.- How a dialog can be “closed” without having problems with the memoey? For example how is guaranteed that the dialog is deleted.
4.- In the manual I have seen expressions of this kind:
virtual Value Scan(const Value& text) const
4.1.- What is the role of the “virtual” qualifier? I have seen that virtual functions are specially made for been overridden.
4.2.- Why the argument is a &?
4.3.- Any other suggestion related with "good" practices when programming.
I am sorry about my poor knowledge of C++. Your help is very appreciated.
Many thanks.
Best wishes,
Javier
|
Hi Javier,
First, I didn't get the warning at the end and I didn't even see anything that might cause trouble in your sources. I tested with GCC on Linux, maybe windows compiler behaves bit different... Someone else might be able to help you.
Now to your questions:
1. I use the same way as you. It is the simplest and most elegant solution I know.
2. There are DblStr, StrDbl, IntStr and StrInt functions. If you need something more fancy for number->String conversion, you can use Format* functions.
3. As I said, I didn't see any problems with the app nor in code. All the dialogs in U++ (if used properly, and you did) live until their scopes end. That means that if you create a dialog in your app it exists until it's parent exists or until it's scope (denoted by {}) ends. The default destructor takes care about deleting it properly.
4.1 In C++ virtual means that the function can be overriden, that is all there is to it. The reason for this is that sometimes you need more special behavior in the derived class, so you can just override the functions from base class.
4.2 The & in function argument generaly denotes that the argument should be passed by reference. That means that only address of the object is sent to the function and it operates on the same object as the rest of your program. If you omit the & it will be first copied and this copy will be passed to the function. This have two serious consequences: First, passing by reference is much faster, second, the modifications you do to the object will persist even after the function call.
And at the end few hints for you 
1) Sizeable() should add MaximizeBox and MinimizeBox automatically, sou you don't have to call them explicitly.
2) This boton_ok.WhenAction=callback(this,&dialogo::salir_ok); can be written as boton_ok.WhenAction=THISBACK(salir_ok); or even as boton_ok<<=THISBACK(salir_ok); All you have to do for this macro to work is to add one typedef to the class definition: class dialogo:public TopWindow{
public:
typedef dialogo CLASSNAME;
dialogo();
... U++ saves you some typing 
3) I see you are not using the layouts yet, so just for future: You can put all your layouts into one .lay file, no need to have a one file per layout.
I hope my answers were at least a bit useful to you.
Honza
|
|
|
|
|
Re: Message from the system. [message #27125 is a reply to message #27121] |
Sun, 27 June 2010 07:39   |
|
281264 wrote on Sun, 27 June 2010 00:07 | Hi,
I am attaching the files of the application in question (please remember that the purpose is to get familiar with U++). The application is very simple: open a dialog by clicking the button in the TopWindow; then type two (double) values in the Edit Fields; then press OK button , close dialog and then compute the multiplication and then show the outcome in the EditField in the TopWindow.
|
I'll try to help.
It is important that the chosen path (sequence of actions to create the program) is important!
Quote: |
The idea is to practice with dialogs: how to create them, how to transfer values to the TopWindow, etc.
You will see that I still have no idea about how to position the widgets in the dialog, therefore the layout in the dialog is rubbish.
|
You must use the Layout Designer better.
Quote: |
Taking advantage of your help, please allow me to ask some questions:
1.- How to pass the values from the EditFields in the dialog to the TopWindow; so far I have declared public the variables in the dialog so they can be accessed;
|
-To pass from program variable to dialog variable use this construction:
dialog_var <<= program_var;
-To get from dialog variable to program variable use this:
program_var = ~dialog_var;
Quote: |
2.- How a string captured by a EditField can be converted to a numerical value (let us say double) and vice versa;
|
You must use Convert classes as ConvInt or simple use EditInt (what is the same).
Quote: |
3.- How a dialog can be “closed” without having problems with the memoey? For example how is guaranteed that the dialog is deleted.
|
dialog is stack variable, because it's deleted automatically
Quote: |
4.- In the manual I have seen expressions of this kind:
virtual Value Scan(const Value& text) const
|
Here, I just can not say. I do not use it.
Quote: |
4.1.- What is the role of the “virtual” qualifier? I have seen that virtual functions are specially made for been overridden.
|
Yes, overriden member is variant to action with Ctrl.
Quote: |
4.2.- Why the argument is a &?
|
It's easy. Passing parameters not by value, but on reference. This technique simply allows the function to direct modify the value of the parameter variable.
Quote: |
4.3.- Any other suggestion related with "good" practices when programming.
|
practice for this task (My experiment with ScreenCasting):
http://ultimatepp.svsoft.ru/for-javier.html
PS
Sorry for my English
SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
|
|
|
|
Re: Message from the system. [message #27130 is a reply to message #27128] |
Sun, 27 June 2010 13:22   |
|
koldo wrote on Sun, 27 June 2010 14:25 | Hi Sergey
If you upload it to YouTube we can link this nice video in web 
|
Unfortunately I do not know how to do it.
Current video link is permanent, so you can easily use.
If you lay out a video on youtube I'll be grateful.
Link to the original video (without the player) -
http://ultimatepp.svsoft.ru/out-4.flv
(this video maked with gtk-recordMyDesktop)
Finally, if I can help someone with a short video - Welcome.
PS
Thank you for your interest in my creation.
SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
[Updated on: Sun, 27 June 2010 13:49] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Message from the system. [message #27165 is a reply to message #27159] |
Tue, 29 June 2010 10:16   |
|
Something is unstable and jerky video when viewing under Linux.
Vimeo on Linux works worse than Youtube.
SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
|
|
|
|
Re: Message from the system. [message #27168 is a reply to message #27166] |
Tue, 29 June 2010 11:16  |
|
I write it for solving some problem of our user.
Maybe we need write alternate text for public tutorial?
I'm afraid I'll have to rewrite the sound or even a full video from the beginning with a decrease in duration.
I would like to hear comments from the English-speaking about the English text and the possible adjustments, if I made a mistake somewhere (I think it happened a couple times, but for the purposes for which it was done - it was permissible for a public text, it seems to me should perform better elaborated)
SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
|
|
|
Goto Forum:
Current Time: Mon Apr 28 01:02:38 CEST 2025
Total time taken to generate the page: 0.00861 seconds
|
|
|