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 » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » Icons
Icons [message #1366] Wed, 01 March 2006 02:16 Go to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
Greetings:

I was wondering how I would make an icon for my application? I have the .ico file I wish to use however I'm not sure how to code it to change the standard application icon (when compiled) to my .ico icon. Could someone please help me?

Thanks.
Re: Icons [message #1371 is a reply to message #1366] Wed, 01 March 2006 10:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mentaltruckdriver wrote on Tue, 28 February 2006 20:16

Greetings:

I was wondering how I would make an icon for my application? I have the .ico file I wish to use however I'm not sure how to code it to change the standard application icon (when compiled) to my .ico icon. Could someone please help me?

Thanks.



Well, actually, this part is a little but tricky for U++, as this is the only use of .rc file (I believe we are speaking about Win32 here).

Put icon.ico to your package directory.

Add app.rc:

5555 ICON DISCARDABLE "icon.ico"


This will make icon appear in Windows filesystem.

Add

app.Icon(Image::Icon(5555, true), Image::Icon(5555, false));


into your GUI_APP_MAIN (app is your main app window; alternatively put Icon.... to its constructor)

Mirek
Re: Icons [message #1382 is a reply to message #1371] Wed, 01 March 2006 22:14 Go to previous messageGo to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
thanks!!

EDIT: see error messages below...

[Updated on: Wed, 01 March 2006 22:32]

Report message to a moderator

Re: Icons [message #1383 is a reply to message #1371] Wed, 01 March 2006 22:31 Go to previous messageGo to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
umm...when i compile it gives me this error:

C:\upp\mingw\bin/windres.exe: can't open icon file `icon.ico': No such file or directory
App.cpp
C:\App\AppLocation\App\App.cpp: In function `void GuiMainFn_()':
C:\App\AppLocation\App\App.cpp:445: error: `app' undeclared (first use this function)
C:\App\AppLocation\App\App:445: error: (Each undeclared identifier is reported only once for each func
tion it appears in.)
2 file(s) compiled in (0:08.93) 4468 msec/file

There were errors. (0:09.25)

What did I do wrong??
Re: Icons [message #1384 is a reply to message #1383] Wed, 01 March 2006 22:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mentaltruckdriver wrote on Wed, 01 March 2006 16:31

umm...when i compile it gives me this error:

C:\upp\mingw\bin/windres.exe: can't open icon file `icon.ico': No such file or directory
App.cpp
C:\App\AppLocation\App\App.cpp: In function `void GuiMainFn_()':
C:\App\AppLocation\App\App.cpp:445: error: `app' undeclared (first use this function)
C:\App\AppLocation\App\App:445: error: (Each undeclared identifier is reported only once for each func
tion it appears in.)
2 file(s) compiled in (0:08.93) 4468 msec/file

There were errors. (0:09.25)

What did I do wrong??



Hard to say. Looks like you do not have icon.ico file in your package directory and that you do not have app declared inside GUI_APP_MAIN....

Maybe I was not clear enough, in your code should be something like

struct MyApp : TopWindow {....

// or perhaps : WithMyLayout<TopWindow>

.....

GUI_APP_MAIN {
   MyApp app;
   app.Icon(Image::Icon(5555, true), Image::Icon(5555, false));
   app.Run();
}


Mirek
Re: Icons [message #1385 is a reply to message #1384] Wed, 01 March 2006 22:56 Go to previous messageGo to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
ah. thanks
Re: Icons [message #1392 is a reply to message #1384] Thu, 02 March 2006 00:55 Go to previous messageGo to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
OK it compiles correctly and the icon works however when I close the application it gives me the "This application has encountered a problem and needs to close..." - which never occured before I got the icon working. Here is a snippet of my code from the GUI_APP_MAIN line down:

GUI_APP_MAIN

{
     
    SetLanguage(LNG_ENGLISH);
    
    

    MyAppFs().Type("MyApp Documents", "*.wrd")

             .AllFilesType()

             .DefaultExt("wrd");

    PdfFs().Type("Portable Document Files", "*.pdf")

           .AllFilesType()

           .DefaultExt("pdf");

 

    LoadFromFile(callback(SerializeApp));
    
    MyApp app;
    app.Icon(Image::Icon(5555, true), Image::Icon(5555, false));

    Ctrl::EventLoop();

    StoreToFile(callback(SerializeApp));

}


What's happening???
Re: Icons [message #1396 is a reply to message #1392] Thu, 02 March 2006 05:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, based on what you listed, LoadFromFile(callback....) feels strange. I would need to see more of your code (consider simply zipping the package and posting next time).

My bet is that something is wrong with SerializeApp.

Mirek
Re: Icons [message #1410 is a reply to message #1396] Thu, 02 March 2006 23:29 Go to previous messageGo to next message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
Aha! I found the problem!

When I implemented the code for the icon:

   MyApp app;
   app.Icon(Image::Icon(5555, true), Image::Icon(5555, false));


I removed the

new MyApp;


from the code or else when I ran it it would create two windows. when I put that line of code back in it didn't crash. Now I need to find a way to keep that line of code and work the app; part into it. Any help with this is appreciated.

Thanks.
Re: Icons [message #1412 is a reply to message #1410] Thu, 02 March 2006 23:38 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mentaltruckdriver wrote on Thu, 02 March 2006 17:29

Aha! I found the problem!

When I implemented the code for the icon:

   MyApp app;
   app.Icon(Image::Icon(5555, true), Image::Icon(5555, false));


I removed the

new MyApp;


from the code or else when I ran it it would create two windows. when I put that line of code back in it didn't crash. Now I need to find a way to keep that line of code and work the app; part into it. Any help with this is appreciated.

Thanks.


Hm, I am quite confused about your code now. Please, zip the whole package and post here... Wink

Mirek
Re: Icons [message #1415 is a reply to message #1412] Fri, 03 March 2006 02:10 Go to previous message
mentaltruckdriver is currently offline  mentaltruckdriver
Messages: 14
Registered: March 2006
Promising Member
never mind I fixed it...
Embarassed Embarassed Embarassed Embarassed Embarassed
Previous Topic: Will not create packaqge with <empty> template
Next Topic: Console Output In Linux
Goto Forum:
  


Current Time: Mon Apr 29 14:59:23 CEST 2024

Total time taken to generate the page: 0.04162 seconds