Ecere SDK/eC Forums http://ecere.org/community/ Print view |
|
Splash class http://ecere.org/community/viewtopic.php?f=5&t=211 |
Page 1 of 2 |
Author: | D.Bane [ Mon Jan 16, 2012 1:00 pm ] |
Post subject: | Splash class |
Hi to all again. Happy holidays to all (even though they have passed for some and as I saw on forum, for some will only begin). I am sorry for not having time to come sooner but here is the splash class that I had promised earlier. This class could probably be better written, so if you find errors do tell me as well so I know where I made them. I wanted to create more effects but unfortunately am not able to find my VB splash form where I had them, so here are only the basic ones. The file you would need to include in your project in order to use splash screen is the "splash.ec". The file "form1.ec" and "MySplash.epj" serve only as an example of how it would look. I hope that you like them. Best Wishes to all, D.Bane |
Author: | jerome [ Sat Feb 04, 2012 3:23 am ] |
Post subject: | Re: Splash class |
Hi D.Bane! Sorry for taking so long to reply... As you know I am on holidays in Vietnam, and I was working hard on improving the eC Distributed Objects, used in my implementation of the Blokus game: Source code @ GitHub Win32 binaries I will try to answer all your questions, in this Splash screen code and on the forums as well. So first, Splash::OnRedraw You ask: //delete bitm; //causes weird things..Should we not get it destroyed?? Well, it turns out that no, you don't need to destroy it. The goal of the BitmapResource class is to hold the Bitmap object for you and decide when to destroy / reload it (i.e. loading when first using it in a particular display driver, getting rid of it when no more window makes use of it in that display driver). And since BitmapResource bmpLogo { } is a member instance, it gets itself deleted automatically when the Splash object is gone. I noticed also: //for now txtLogoSmCap.position.x = txtLogoCap.position.x + txtLogoCap.size.w; It's best if any 'state modifying' code is left out of OnRedraw. The Ecere GUI model is that OnRedraw simply 'renders' the current state, and any state modification should be done outside... It could be for example, in an input event, or in a timer's DelayExpired event... In your case, perhaps you mean to put it on initialization. The best place is probably OnLoadGraphics, where the font would have been loaded. Using multiple fonts in your OnRedraw method The way to do this easily is with FontResource that manages the fonts for you, just like the BitmapResource. The alternative to FontResource/BitmapResource is to manually Load/Unload the fonts and bitmaps in OnLoadGraphics() and OnUnloadGraphics(). (Using Display::LoadFont and Bitmap::Load) So you declare the font resources in your window this way: Code: Select all
Code: Select all
I just noticed you are doing AddResource/RemoveResource with bmpLogo. When you do 'window = this' for the BitmapResource: BitmapResource bmpLogo {fileName = ":SplashLogo.png", window = this;}; You do not need to manually Add/Remove resources (It's to save you from having to implement OnLoadGraphics/OnUnloadGraphics and do it for all bitmaps). So in this case it is redundant... TextLogoPrepare You have CopyString() inside TextLogoPrepare (And only for the "E"?), but the way you use it, you do not require a new copy each time... So this is a memory leak. Setting the 'text' propery on a label (or other window) will make its own copy of the string. So return "E"; is right. currentlyLoading property The reason it would crash on a delete, is because you are passing in a string literal constant, which should not get deleted. What you can do, as is common practice, is make String properties copy the incoming string (deleting the previous one beforehand as you're doing is good, though the null check is superfluous with delete, and making sure to clean it on destruction). Example: Code: Select all
Cheers! Jerome |
Author: | D.Bane [ Wed Feb 08, 2012 8:18 am ] |
Post subject: | Re: Splash class |
Hi Jerome. Thank you very much for the response with so many valuable comments. I was looking for a way to use those fonts Now, I'll certainly have some more fun Sorry about my late response as well , I was busy . As soon as I had time I wanted to check the tooltips and splash. I have updated the splash control (well only a part of it), but since I had little time I did not respond to you because of the errors I got. I thought that I messed something up, but I took another look today and I do not see what may be a problem. Basically I added a variable: String textLogo; a property for same and updated the function to return textLogo[0] + textLogo[1->end]. But all that it did was going into an endless loop on PrintBuf(); I will attach the file so you can see what I had done. Basically it all starts at the String TextLogoPrepare(bool returnMain) function at line 355. Is that related to the newest source with tooltips or am I missing something? Again, thank you Jerome for the help and answers All the best, D.Bane. |
Author: | jerome [ Sat Feb 11, 2012 2:46 am ] |
Post subject: | Re: Splash class |
Just to make sure you don't miss it, I've answered in this post |
Author: | samsam598 [ Thu Nov 29, 2012 2:22 am ] |
Post subject: | Re: Splash class |
Just found that the splash screen can be closed by closing on the taskbar icon if the splashing time is long enough.The taskbar icon shows up there even if the property showInTaskBar=false. Another issue,recently find that those created forms (projects) times ago inside which those controls who has a hot key (AltO for example) will not pass during compiling time,it complained that Code: Select all
Regards, Sam |
Author: | jerome [ Wed Jun 05, 2013 9:45 pm ] |
Post subject: | Re: Splash class |
Hi Sam! Sorry for the very late reply, I must have missed this post somehow! Haven't seen you around in a while either, I hope you are well! Those errors must be caused by the change of order of properties, and they are probably not set explicitly (i.e. hotKey = altD). Perhaps they follow 'text' which was made obsolete in favor of 'caption'. As for the splash screen which shows up in the taskbar, was that on Windows or Linux? Perhaps settings 'master' to another form or setting interim = true might do it... I'd have to check with the project ) Regards, Jerome |
Author: | jonaspm [ Thu Jun 06, 2013 2:19 am ] |
Post subject: | Re: Splash class |
I also experience that under Windows 7 |
Author: | jerome [ Thu Jun 06, 2013 9:42 am ] |
Post subject: | Re: Splash class |
OK I did some quick testing and here's the clarification: - The 'showInTaskBar' property defaults to 'false', and is useful for 'forcing' a window to show up in task bar, not to take it out of there - The circumstances when a window will show up in a taskbar are quite complex, from Windows. Here are some articles explaining them: http://msdn.microsoft.com/en-us/library/aa969325.aspx http://blogs.msdn.com/b/oldnewthing/arc ... 46371.aspx From this Stack Overflow post ( http://stackoverflow.com/questions/8204 ... pwindow-do ): In Ecere this translates to: - By default, windows without a parent (top level window, confined only to the desktop) will show up in the taskbar unless they have a master (owner) and are either marked as modal (isModal = true) or interim (interim = true). - To force a window to show up in the taskbar, set showInTaskBar to true. To force a top-level, unowned window not to show up in the taskbar, you could use an invisible window as a master: Code: Select all
Jerome |
Author: | jonaspm [ Mon Jun 10, 2013 5:46 pm ] |
Post subject: | Re: Splash class |
that's good to know, thanks a lot |
Author: | samsam598 [ Wed Aug 28, 2013 3:18 am ] |
Post subject: | Re: Splash class |
The test project file seem's broken.Mine old test project doesn't work for this Splash class,app crashed upon startup. |
All times are UTC-05:00 | Page 1 of 2 |
Powered by phpBB® Forum Software © phpBB Limited |