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 » Hello, need a helping hand
Hello, need a helping hand [message #26830] Tue, 01 June 2010 15:11 Go to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi folks

I'm an absolute newbie to C++ coding and UPP. I code in C and VB6. I stumbled upon UPP a few days back and find it really interesting; however, my lack of knowledge about C++ and UPP is only making it difficult to cross the initial barriers.

I have worked with the examples and am able to run almost all of them. There are some that I cannot understand that report errors(in the uppsrc directory). I work on a WinXP machine.

Right now, I am able to create the example code called shopping list I found on the www. This was a very nice example to learn UPP. However, the next step has frustrated me and I will like a helping hand if anyone can.

On the layout, I wish to place a slider control visually (if that is possible) and link it to a text label that will show the value of the slider. I am able to place the static text label & name it. But, how do I place the slider? I suspect it has to be done in code. Being a total newbie in UPP and a total zero in C++ means a double whammy and I'm stuck. I want to migrate away from VB6 and come to UPP.

I intend to add new controls and eventually graduate to creating a simple RS232 terminal for my own use while 'learning the ropes'

Can anyone guide me gently please ?

I will appreciate links too if this is something I missed here.

Thanks
Re: Hello, need a helping hand [message #26831 is a reply to message #26830] Tue, 01 June 2010 15:55 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
jerson wrote on Tue, 01 June 2010 15:11

Hi folks

I'm an absolute newbie to C++ coding and UPP. I code in C and VB6. I stumbled upon UPP a few days back and find it really interesting; however, my lack of knowledge about C++ and UPP is only making it difficult to cross the initial barriers.

I have worked with the examples and am able to run almost all of them. There are some that I cannot understand that report errors(in the uppsrc directory). I work on a WinXP machine.

Right now, I am able to create the example code called shopping list I found on the www. This was a very nice example to learn UPP. However, the next step has frustrated me and I will like a helping hand if anyone can.

On the layout, I wish to place a slider control visually (if that is possible) and link it to a text label that will show the value of the slider. I am able to place the static text label & name it. But, how do I place the slider? I suspect it has to be done in code. Being a total newbie in UPP and a total zero in C++ means a double whammy and I'm stuck. I want to migrate away from VB6 and come to UPP.

I intend to add new controls and eventually graduate to creating a simple RS232 terminal for my own use while 'learning the ropes'

Can anyone guide me gently please ?

I will appreciate links too if this is something I missed here.

Thanks


Hello Jerson

Yes, you can enter the SliderCtrl in the Layout designer.

If you right click the mouse in the Layout designer and choose Progress/SliderCtrl you will get it.

To do it in a very simple way you can get the package Reference/Layout, and modify it adding an SliderCtrl.

For example, in Layout example after adding:

- a SliderCtrl named slider

- a Label named text;

, change the code with this:

void Slider() {
    text = AsString(~slider);
}

GUI_APP_MAIN
{
    WithDialogLayout<TopWindow> dlg;
    CtrlLayoutOKCancel(dlg, "Enter a number");
    dlg.number <<= 10;
    dlg.slider <<= THISBACK(SliderFunc);
    for(;;)
        switch(dlg.Execute()) {
        case IDOK:
            PromptOK(AsString(~dlg.number));
            break;
        case IDCANCEL:
            return;
        }
}


I advise you to follow this:

1. Check the samples:
After that you like U++.

2. Read the documentation:
After that you understand

3. Check the samples you prefer again and read the code
After that you really understand Smile


Best regards
Iñaki
Re: Hello, need a helping hand [message #26832 is a reply to message #26830] Tue, 01 June 2010 16:04 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Jerson,

Welcome to U++ ! Smile

It is of course possible to create the application GUI visually. Have a look at the GUI tutorial, section 16 describes the basics. To get into the layout designer, just add a file with .lay extension into you package. Any widget, including SliderCtrl, can be added by right-clicking in the design area and selecting them from the context menu.

As for RSS232, there are already some classes ready to use, it should be not too hard to create a simple terminal for educational purposes Wink

Don't be afraid to ask questions. You can do it here, or you can try your luck on our irc channel #upp on slashnet.org (webclient), most of the time there is someone present.

Best regards,
Honza

PS: I see Koldo was faster to answer... Anyway, one more opinion never hurts Smile

[Updated on: Tue, 01 June 2010 16:11]

Report message to a moderator

Re: Hello, need a helping hand [message #26838 is a reply to message #26832] Tue, 01 June 2010 20:07 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Koldo, Honza

Thanks for your prompt reply. It really boosts the confidence of a newbie.

Well, I'm sure I can get past the basics easily, but trying to put the slider is still something I cannot figure on the layout. Right clicking on the layout does not show progress / slider controls. Is there something more to it than I can see? I know these must be utterly trivial to understand once I can see it. Please excuse me for asking again.

Right click shows me the following. I am sure I am missing something which you guys aren't.
index.php?t=getfile&id=2567&private=0
Clicking on ctrllib in the left pane shows the presence of sliderctrl.cpp and its associated .h Is there some way to get them on the layout via the right click?

If it helps, the zip I downloaded is upp-mingw-605.zip for the windows platform.

The examples of the slider and sliderprogress in the reference folder use the slider in code and is not the immediate answer I seek. I need to familiarize myself with the layout tool before swimming in the deep end Wink

Thanks again for your support.

Regards
Jerson
Re: Hello, need a helping hand [message #26839 is a reply to message #26838] Tue, 01 June 2010 20:46 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

jerson wrote on Tue, 01 June 2010 20:07


If it helps, the zip I downloaded is upp-mingw-605.zip for the windows platform.


Yes, that helps a lot - that is a 4 years old version, SliderCtrl wasn't born yet back then Wink

You should grab a latest stable (nightly builds are not available today...). Installing that over your previous installation should help to solve the slider problem, plus you get improved sources and theide Wink

As for mingw: You might experience some troubles, especially if you want to do multithreaded apps later. There were good reasons to stop providing the bundled packages some time ago. You should consider installing freely downloadable M$ Visual C++ Express compiler and windows SDK. Or at least TDM release of mingw, it is reported to work much better.

Honza
Re: Hello, need a helping hand [message #26842 is a reply to message #26839] Wed, 02 June 2010 03:19 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Thanks Honza

I got the latest 2361 build and will work with it. Thanks for all your help

Jerson
Re: Hello, need a helping hand [message #26892 is a reply to message #26842] Mon, 07 June 2010 06:09 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hello

I'm back again with a little more understanding than when I first started here. I have been able to work through most of the tutorials and wanted to have a 'feel' of the bazaar apps. I tried some apps and except the GUI MT variety, the normal GUI variety works. For example, the Controls-4Udemo gives me this

----- CtrlLib ( GUI MT GCC BLITZ WIN32 ) (1 / 17)
----- Controls4U ( GUI MT GCC BLITZ WIN32 ) (2 / 17)
Controls4U.cpp
In file included from C:/MyApps/Functions4U/Functions4U.h:410,
                 from C:/MyApps/Controls4U/Controls4U.h:5,
                 from C:\MyApps\Controls4U\Controls4U.cpp:5:
C:/MyApps/Functions4U/Functions4U_Gui.h:67:7: warning: no newline at end of file
Controls4U: 1 file(s) built in (0:08.17), 8172 msecs / file, duration = 8344 msecs
----- plugin/gif ( GUI MT GCC BLITZ WIN32 ) (3 / 17)
----- plugin/jpg ( GUI MT GCC BLITZ WIN32 ) (4 / 17)
----- plugin/tif ( GUI MT GCC BLITZ WIN32 ) (5 / 17)
----- CtrlCore ( GUI MT GCC BLITZ WIN32 ) (6 / 17)
----- Draw ( GUI MT GCC BLITZ WIN32 ) (7 / 17)
BLITZ: DrawLock.cpp Font.cpp FontCR.cpp FontWin32.cpp FontFc.cpp Draw.cpp DrawText.cpp DrawData.cpp Drawing.cpp ImageAnyDraw.cpp DrawU
	til.cpp DrawTextUtil.cpp Display.cpp Image.cpp ImageBlit.cpp RasterFormat.cpp RasterWrite.cpp Palette.cpp Raster.cpp RasterEncoder
	.cpp ImageOp.cpp ImageChOp.cpp ImageScale.cpp MakeCache.cpp DrawRasterData.cpp Cham.cpp SSettings.cpp
In file included from C:/upp/out/Draw/MINGW.Blitz.Gui.Mt\$blitz.cpp:3:
C:\upp\uppsrc\Draw\DrawLock.cpp:11: error: thread-local storage not supported for this target
In file included from C:/upp/out/Draw/MINGW.Blitz.Gui.Mt\$blitz.cpp:10:
C:\upp\uppsrc\Draw\Font.cpp:273: error: thread-local storage not supported for this target
C:\upp\uppsrc\Draw\Font.cpp:335: error: thread-local storage not supported for this target
C:\upp\uppsrc\Draw\Font.cpp:362: error: thread-local storage not supported for this target
C:\upp\uppsrc\Draw\Font.cpp:363: error: thread-local storage not supported for this target
C:\upp\uppsrc\Draw\Font.cpp:364: error: thread-local storage not supported for this target
Draw: 27 file(s) built in (0:03.20), 118 msecs / file, duration = 3469 msecs


Is this because I use the mingw compiler? Is there a particular reason you recommend the VC++ express compiler over the mingw? I resisted the download of the MSVC++ compiler because it demands the .NET framework to be downloaded too. I already have .NET2.0, .NET3.0 and .NET3.5 fws on my machine. A little detail will help clear this for me since these are tools I've never used before. Are there some precompiled binaries for the bazaar apps for win32 that I can try out?

On another note, is there some kind of comparison of a real world product that uses UPP vs traditional IDEs like VB or VC? I have almost made up my mind to do the crossover and a little nudge will help make that decision for me.

Please excuse the newbiesque questions. I really am a UPP newbie Wink and am grateful for the assistance you offer.

Thanks

[Updated on: Mon, 07 June 2010 06:11]

Report message to a moderator

Re: Hello, need a helping hand [message #26893 is a reply to message #26892] Mon, 07 June 2010 08:02 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Jerson!
jerson wrote on Mon, 07 June 2010 06:09

Is this because I use the mingw compiler? Is there a particular reason you recommend the VC++ express compiler over the mingw? I resisted the download of the MSVC++ compiler because it demands the .NET framework to be downloaded too. I already have .NET2.0, .NET3.0 and .NET3.5 fws on my machine. A little detail will help clear this for me since these are tools I've never used before. Are there some precompiled binaries for the bazaar apps for win32 that I can try out?

Yes, you hit the restrictions of mingw. The original mingw does not implement thread local storage which is crucial for MT applications. That is actually also the main reason why VC++ is recommended. But if you want to keep using mingw, you still can - just download the installer from Twilight Media Dragon site, delete the upp/mingw directory and install the downloaded one in the same place, it should work right away Wink This version of mingw is tweaked a bit so that it supports everything U++ needs. I personally have never used VC++ (I work mainly in Linux and when I need to compile something on windows occasionally, I use mingw, because I'm lazy to install NET Smile ).

jerson wrote on Mon, 07 June 2010 06:09

On another note, is there some kind of comparison of a real world product that uses UPP vs traditional IDEs like VB or VC? I have almost made up my mind to do the crossover and a little nudge will help make that decision for me.


You can find some examples of real world apps in Applications section of this web. Also some other user created apps can be found on the designated section of this forum. Very nice example is Mindtravelers STermPro. And Sergeys industrial hardware programing is definitely a must read Wink

jerson wrote on Mon, 07 June 2010 06:09

Please excuse the newbiesque questions. I really am a UPP newbie Wink and am grateful for the assistance you offer.

We like to see newbies here Wink Getting used to U++ is not easy and we know it, so we try to help as much as possible. But once you get familiar with the ideas of U++, you became an addict Twisted Evil

Regards,
Honza
Re: Hello, need a helping hand [message #26894 is a reply to message #26893] Mon, 07 June 2010 09:37 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Honza

I really appreciate your help a lot. Thank you.

I have explored the apps on this site and also seen the Stermpro. That really caught my imagination because I am aiming to do something similar. RS232 to talk with my devices.

The ease of use of UPP led me to learn C++, in a big hurry. Now, I can grasp the concepts and understand how to 'read' the code. I am sure I will be able to get the ropes pretty soon.

I have still to explore the help files to understand more of UPP.

I know I'll have more questions, but, I'll cross that when I'm there.

Cheers
Jerson
Re: Hello, need a helping hand [message #26895 is a reply to message #26893] Mon, 07 June 2010 09:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Jerson

In addition to excellent dolik.rce answer:

- MinGW
Actual MinGW versions are good for multitasking.
You can get them from:
-- MinGW. MinGW version 4.4.0 (perhaps 4.5.0) (http://www.mingw.org/)
-- TDM. MinGW version 4.4.1 (http://www.tdragon.net/recentgcc/)

- Other professional software done with U++:
OpenWIND (http://www.awsopenwind.org/)
It is a wind farm design software with source code


Best regards
Iñaki
Re: Hello, need a helping hand [message #26897 is a reply to message #26895] Mon, 07 June 2010 10:36 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

I have 2 versions of mingw now. Original mingw-5.1.6 that does not compile the MT demos from bazaar section(uninstalled now)

TDM-mingw-4.4.1-2 that compiles some of the demos, but gives errors for others. In the controls4u_demo, it is asking for
In file included from C:/upp/out/Functions4U/MINGW.Blitz.Gui.Mt\$blitz.cpp:3:
C:\MyApps\Functions4U\Functions4U.cpp: In member function 'bool Dll::Load(const Upp::String&)':
C:\MyApps\Functions4U\Functions4U.cpp:1741: error: 'LOAD_IGNORE_CODE_AUTHZ_LEVEL' was not declared in this scope
Functions4U: 7 file(s) built in (0:02.90), 415 msecs / file, duration = 2969 msecs


In the Ultimateplayer example, I get this. There are a lot more errors than just this.
c++.exe: WIN32: No such file or directory
UltimatePlayer.cpp
C:\MyApps\UltimatePlayer\UltimatePlayer.cpp:4:25: error: fmod_errors.h: No such file or directory
In file included from C:\MyApps\UltimatePlayer\UltimatePlayer.h:16,
                 from C:\MyApps\UltimatePlayer\UltimatePlayer.cpp:17:
C:\MyApps\UltimatePlayer\FMod.h:8: error: 'FMOD' has not been declared
C:\MyApps\UltimatePlayer\FMod.h:8: error: ISO C++ forbids declaration of 'System' with no type
C:\MyApps\UltimatePlayer\FMod.h:8: error: expected ';' before '*' token
C:\MyApps\UltimatePlayer\FMod.h:9: error: 'FMOD' has not been declared


Perhaps this example is meant for Linux rather than Win32.

I think it will be an uphill task till I reach some basic level with UPP Razz

Jerson

[Updated on: Mon, 07 June 2010 10:36]

Report message to a moderator

Re: Hello, need a helping hand [message #26898 is a reply to message #26897] Mon, 07 June 2010 10:53 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
For the second error, UltimatePlayer uses FMOD, o third party audio software which you will have to install separately and configure your ide to find the path to it. It definitely works under Windows.
Re: Hello, need a helping hand [message #26899 is a reply to message #26898] Mon, 07 June 2010 11:11 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Jerson

For first error I think you do not have the latest sources.

Please get them as they have this before the error you get.

#ifndef LOAD_IGNORE_CODE_AUTHZ_LEVEL
	#define LOAD_IGNORE_CODE_AUTHZ_LEVEL	0x00000010
#endif


Best regards
Iñaki
Re: Hello, need a helping hand [message #26902 is a reply to message #26899] Mon, 07 June 2010 14:27 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Koldo

Sorry, I'm a bit lost here. I have the latest UPP 2361 build. If you meant the control4u demo from the website, I do not see a link to download it. However, changing this line which was complaining
hinstLib = LoadLibraryEx(TEXT(fileDll), NULL, LOAD_IGNORE_CODE_AUTHZ_LEVEL);

to this
	hinstLib = LoadLibraryEx(TEXT(fileDll), NULL, 2);

made controls4udemo work. Now, there is some hope for me Very Happy

Thanks
Jerson
Re: Hello, need a helping hand [message #26904 is a reply to message #26902] Mon, 07 June 2010 15:52 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Jerson

Congratulations! Smile

Anyway you can get latest sources from here http://code.google.com/p/upp-mirror/downloads/list.

Or better from svn here http://code.google.com/p/upp-mirror/source/checkout

About the function, I would use:

hinstLib = LoadLibraryEx(TEXT(fileDll), NULL, 0x10))


If not it will not work Smile. However this function is for loading DLL in Windows and it is not used in the demo.


Best regards
Iñaki
Re: Hello, need a helping hand [message #27405 is a reply to message #26904] Thu, 15 July 2010 16:46 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Koldo

I'm back after a bit. I think I owe it to you that I have been able to get started in UPP. As such, I found it really hard to understand at first. I played a lot with the examples, bazaar projects and read the tutorials. I cannot say for sure I understand everything right now, but, I am at least 35% there in my own estimates.

I have made a screen to check out what I learnt till now and find I can really make some good progress. I need to make a few controls of my own to handle charts(I know about the scatter program) for my own needs. I think the controls4u demo shows how to make such controls with their own interface for the IDE.

index.php?t=getfile&id=2656&private=0
However, for now, this is what I have achieved and for this I owe you a big Thank You.

I have a lot more to do in this project, but, slow and steady wins I guess.

BTW : what do these statements mean? It's a bit like greek to me.

void UWord::SerializeApp(Stream& s)
{
	int version = 1;
	s / version;                <<== this one here
	s % UWordFs()               <<== and here
	  % PdfFs();                <<== and here
	if(version >= 1)
		s % lrufile();
}
  • Attachment: Upp1.gif
    (Size: 31.78KB, Downloaded 694 times)
Re: Hello, need a helping hand [message #27416 is a reply to message #27405] Fri, 16 July 2010 12:18 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
jerson wrote on Thu, 15 July 2010 17:46



BTW : what do these statements mean? It's a bit like greek to me.

void UWord::SerializeApp(Stream& s)
{
	int version = 1;
	s / version;                <<== this one here
	s % UWordFs()               <<== and here
	  % PdfFs();                <<== and here
	if(version >= 1)
		s % lrufile();
}



Hi!

Yes, serialization can seem a little bit confusing at first, but this is one my favorite features. It is very easy to serialize large sets of data.

The serialization API uses operator overloading very heavily and "%" is something like "<<" combined with ">>" from standard C++ API (like you use with cout). It is the standard serialization operator. So if you see:
s % foo % bar;

think of it as:
s.serialize(foo).serialize(bar);

This hypothetical serialize method uses chaining and reference parameters, and in pseudo code it has an implementation like this for every basic type:
Stream& serialize(Foo& foo) {
  if (stream is loading)
    foo.loadFromStream
  else 
    foo.saveToStream
  return stream for chaining;
}


This is the reason you don't need to write a separate load and a separate sore serialization function. After you have become more familiar with the syntax, you can look at the implementation if you are curious and you will see that adding support for serializing your own classes is very easy.
Re: Hello, need a helping hand [message #27758 is a reply to message #26830] Mon, 02 August 2010 08:05 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

I hope you folks will not mind a quick update on my progress with UPP.

This is the latest screenshot.
index.php?t=getfile&id=2698&private=0
I managed to get images on buttons(yeah no big deal you say), open multiple screens(still no big deal?). Still learning these was a big exercise for me, but ..... Smile

Now, moving onto saving and retrieving settings for the screen. I know about the serialize functions and will try to use them for this work.

I am happy to be learning UPP and feel confident I can give really smart programs from now.
  • Attachment: srt.gif
    (Size: 71.65KB, Downloaded 592 times)

[Updated on: Mon, 02 August 2010 08:06]

Report message to a moderator

Re: Hello, need a helping hand [message #27759 is a reply to message #27758] Mon, 02 August 2010 08:59 Go to previous message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Very good Smile.

Best regards
Iñaki
Previous Topic: is U++ the right tool for this?
Next Topic: EditField ctrl and StaticText ctrl in a StatusBar crtl
Goto Forum:
  


Current Time: Thu Mar 28 23:53:11 CET 2024

Total time taken to generate the page: 0.01911 seconds