Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Message from the system.
Message from the system. [message #27109] Fri, 25 June 2010 16:56 Go to next message
281264 is currently offline  281264
Messages: 270
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 #27119 is a reply to message #27109] Sat, 26 June 2010 18:07 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Hello Javier

Please include the complete package for testing.

(PD. Try to change the screenshot from bmp to other lighter format Smile)


Best regards
Iñaki
Re: Message from the system. [message #27121 is a reply to message #27119] Sat, 26 June 2010 22:07 Go to previous messageGo to next message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
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
Re: Message from the system. [message #27122 is a reply to message #27121] Sat, 26 June 2010 23:28 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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 Wink
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 Wink
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 #27123 is a reply to message #27121] Sat, 26 June 2010 23:47 Go to previous messageGo to next message
andrei_natanael is currently offline  andrei_natanael
Messages: 262
Registered: January 2009
Experienced Member
Hi Javier,

I've tested on Windows 7 with MinGW and MSC9 and everything's fine.
Koldo suggested you to use a lighter image format (PNG, JPG) when posting to save forum space. I suggest you to use a more free format when posting archives, zip for example, because it's accessible on other operating systems without installing any proprietary programs and also in Windows exists support for it.

Thanks and best regards,
Andrei
Re: Message from the system. [message #27124 is a reply to message #27123] Sun, 27 June 2010 01:34 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Hello Javier

I fully support posts from dolik.rce and andrei_natanael. No problems with Ubuntu 10.04 and with XP.

In addition if you want multiplication results I would change

//double a=Scan(dialogo_datos.editar_a.GetText());


with

salida_result <<= FormatDouble(ScanDouble(dialogo_datos.editar_a.GetData().ToString())*ScanDouble(dialogo_datos.editar_b.GetData().ToString()));


This seems a little overcomplex. Choosing type EditDouble instead of EditField the code would be much simpler, just multiplying two numbers:

salida_result <<= dialogo_datos.editar_a*dialogo_datos.editar_b;


Try to use layout designer. It saves you non useful code. And point 3 is very important: After dialogo_datos.ExecuteOK(), window is closed but dialogo_datos data is there, nobody has deleted it. So just take the data.

I would never use EditField. I would use EditString, EditDouble, etc.


Best regards
Iñaki
Re: Message from the system. [message #27125 is a reply to message #27121] Sun, 27 June 2010 07:39 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

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 #27128 is a reply to message #27125] Sun, 27 June 2010 12:25 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Hi Sergey

If you upload it to YouTube we can link this nice video in web Smile


Best regards
Iñaki
Re: Message from the system. [message #27130 is a reply to message #27128] Sun, 27 June 2010 13:22 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

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 Smile


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 #27133 is a reply to message #27122] Sun, 27 June 2010 14:04 Go to previous messageGo to next message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
Thank you!; good explanation and useful hints.
Re: Message from the system. [message #27145 is a reply to message #27130] Mon, 28 June 2010 12:51 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
sergeynikitin wrote on 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 Smile


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.


Hello Sergey

I will upload it to YouTube soon (after reducing its time to 10 min).
Meanwhile tomorrow there will be a link to video tutorials in U++ main page.



Best regards
Iñaki
Re: Message from the system. [message #27152 is a reply to message #27145] Mon, 28 June 2010 21:07 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Maybe I try to reduce myself?

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Message from the system. [message #27153 is a reply to message #27152] Mon, 28 June 2010 22:13 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
sergeynikitin wrote on Mon, 28 June 2010 21:07

Maybe I try to reduce myself?

I have uploaded it to Vimeo.

In one hour it will be ready and tomorrow it will be available in U++ web.


Best regards
Iñaki
Re: Message from the system. [message #27159 is a reply to message #27153] Tue, 29 June 2010 08:07 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Here: http://www.ultimatepp.org/www$uppweb$videotutorials$en-us.ht ml

Best regards
Iñaki
Re: Message from the system. [message #27165 is a reply to message #27159] Tue, 29 June 2010 10:16 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

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 #27166 is a reply to message #27165] Tue, 29 June 2010 10:44 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
sergeynikitin wrote on Tue, 29 June 2010 10:16

Something is unstable and jerky video when viewing under Linux.

Vimeo on Linux works worse than Youtube.



Hello Sergey

I am sorry.

If you can reduce its time to less than 10 minutes we can upload it to YouTube.


Best regards
Iñaki
Re: Message from the system. [message #27168 is a reply to message #27166] Tue, 29 June 2010 11:16 Go to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

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 );
}
Previous Topic: Usage of "new" and "delete" in U++
Next Topic: Problems when using layouts
Goto Forum:
  


Current Time: Fri Apr 19 17:59:04 CEST 2024

Total time taken to generate the page: 0.06553 seconds