Ecere SDK/eC Forums
http://ecere.org/community/
Print view

CommonControl issues
http://ecere.org/community/viewtopic.php?f=5&t=183
Page 1 of 1
Author:  D.Bane [ Thu Sep 08, 2011 9:44 am ]
Post subject:  CommonControl issues

Hi.

I wanted to ask you about CommonControl.

I have created few controls, but any time I want to add them trough the Designer window the Ecere IDE just crashes...every time.

If I call my class from the code it works as it should properly..

I am doing most of it from the code, but it pains me not to be able to figure out why does it break?

I am wondering if this is typical to everyone or am I the only one?
If I am the only one what do you think should be a problem?

I wanted to upload it on ecere, as I think someone may like it, but did not want to do it unless I figure it out...do not want to crash peoples IDE's...

Thanks and all the best,
D.Bane.
Author:  jerome [ Thu Sep 08, 2011 9:55 am ]
Post subject:  Re: CommonControl issues

D.Bane, could you upload them here on the forums, and describe how the crash happens, so I can try it out please? :D

Thanks!

Jerome
Author:  D.Bane [ Thu Sep 08, 2011 10:33 am ]
Post subject:  Re: CommonControl issues

Hi,

I hope it does not look like a mess and that you will like it.

I planned to make it go trough its children and position them automatically depending of how it is placed but was not able to figure it out how to o it so I skipped that and started doing something else to return to this after some more experience with eC.

This is how I call it, and it works great

Code: Select all

 
 
// it is called from a function, where me is a pointer to what ever the window will have it as a child...
   Slider sldFirst
   {
      parent = this; //me;
      background = this.background; //me.background;
      positionedAt = left;
      closeText = "Exit";
      dorNobColor = navy;
 
      void OnDestroy()
      {
         //ShowDecision(this.parent);
         //I use it to show some form with choices after it is closed...
      }
 
   sldFirst.stayOnTop = true;
   sldFirst.Create();
 
To repeat the error...Well it happens to me every time I try to add it on a window with my mouse..
I do need to tell you that I do not have the latest ecere installed.
I am using 0.44pre-2010-09-05 - If that makes any difference.
Author:  jerome [ Thu Sep 08, 2011 11:06 am ]
Post subject:  Re: CommonControl issues

D.Bane,

First, I suggest you update to the latest Ecere by cloning it with git from http://github.com/ecere/sdk/ , so we stay on the same pages for fixes and stuff :D

Then I'll note that I've changed the way controls get included on the IDE's toolbox, they have to both derive from CommonControl, and define an icon (class_property(icon) = "slider.png";)

Now I'm wondering how you get to see it in your toolbox, because at the moment the class needs to be compiled to make it there... Are you building ctrlSlider.ec as a dll? I guess I would need to do that as well to reproduce the crash?

Also I get some left over slide bars drawn, I don't know if it's an Update bug in the newer Ecere version? Let me know when you try it with the latest version if it works differently. Because you are repositioning stuff, it looks like you shouldn't require to put an additional parent's Update().

About the cycling, tabCycle = true should let you cycle through children with tabs. There is also the Window::CycleChildren() method that you can invoke to cycle programatically. You can also use the Window::firstChild and Window::next property to manually go through them.

Cheers,

Jerome
Author:  D.Bane [ Thu Sep 08, 2011 5:05 pm ]
Post subject:  Re: CommonControl issues

Hi Jerome.

I had some problem downloading from git...had to download from Firefox in safe mode (something on my side...NoScript/PolicyRequest.......)...

Anyway, downloaded and did a make but got an error:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\DBane\Desktop\ecere-sdk-6748510>mingw32-make
Bootstrapping eC compiling tools...
Building ecere...
Building ec...
Building ecp...
Building ecc...
Building ecs...
All done!
Building dependencies...
Building FreeType...
Building libjpeg...
Building libpng...
Building libungif...
Building zlib...
Building 2nd stage ecere...
Building eAR command line tool...
Building Vanilla Ecere...
Building ear...
Building self-extract tool...
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2008
UPX 3.03w Markus Oberhumer, Laszlo Molnar & John Reiser Apr 27th 2008

File size Ratio Format Name
-------------------- ------ ----------- -----------
1305788 -> 639164 48.95% win32/pe extract.exe

Packed 1 file.
Building eAR command line tool...
Building 2nd stage compiler
Building 2nd stage libec...
C:\Users\DBane\Desktop\ecere-sdk-6748510\compiler\libec\src\lexer.ec:1402:28: wa
rning: incompatible expression yy_ec[((unsigned int)(unsigned char)*yy_cp)] (int
); expected byte
C:\Users\DBane\Desktop\ecere-sdk-6748510\compiler\libec\src\lexer.ec:1412:13: wa
rning: incompatible expression yy_meta[(unsigned int)yy_c] (int); expected byte
C:\Users\DBane\Desktop\ecere-sdk-6748510\compiler\libec\src\lexer.ec:2570:27: wa
rning: incompatible expression (*yy_cp ? yy_ec[((unsigned int)(unsigned char)*yy
_cp)] : (unsigned char)1) (int); expected byte
C:\Users\DBane\Desktop\ecere-sdk-6748510\compiler\libec\src\lexer.ec:2580:12: wa
rning: incompatible expression yy_meta[(unsigned int)yy_c] (int); expected byte
C:\Users\DBane\Desktop\ecere-sdk-6748510\compiler\libec\src\lexer.ec:2615:11: wa
rning: incompatible expression yy_meta[(unsigned int)yy_c] (int); expected byte
C:\Users\DBane\Desktop\ecere-sdk-6748510\compiler\libec\src\lexer.ec:427:26: war
ning: incompatible expression c (int); expected char
C:\Users\DBane\Desktop\ecere-sdk-6748510\compiler\libec\src\lexer.ec:435:29: war
ning: incompatible expression c (int); expected char
C:\Users\DBane\Desktop\ecere-sdk-6748510\compiler\libec\obj\release.win32\ec.mai
n.ec:571:1: warning: Redefinition of sourceFileStack (defining as char[10][MAX_L
OCATION], already defined as char[MAX_INCLUDE_DEPTH][MAX_LOCATION])
Building 2nd stage ecp...
Building 2nd stage ecc...
Building 2nd stage ecs...
Building eC Core Runtime...
Enabling 2nd stage binaries...
Building IDE...
Building epj2make...
Building Documentor...
C:\Users\DBane\Desktop\ecere-sdk-6748510\documentor\obj\release.win32\documentor
.main.ec:1:1: error: Couldn't open obj/release.win32\documentor.main.sym
mingw32-make[1]: *** [obj/release.win32/documentor.main.c] Error 1
mingw32-make: *** [documentor] Error 2

C:\Users\DBane\Desktop\ecere-sdk-6748510>
I will add the icon property and check again :)

Oh jea, I found the exes in the folders even if there was an error so I copied the files over the old ones, I have to say, the colors... Beautiful :)

I like the black background. And the line numbers work nicely :D

The only thing I miss is the old ecere look (top window border), kind of got used to it...although this is a pretty looking one as well.
There are many changes as far as I can tell, just by looking at it.

Now, for slider...
No, I did not make a dll.

I did 'import "ctrlSlider"' and it was shown in the toolbox. That is when the problem was made..When clicked on EditBox, you are able to click on form and it will be made in that position, but with my control it is not. It would just crash IDE.

I will take a look at it again and update it with Window::CycleChildren() cycle. Is there anything I should look out for? Or is the Window::firstChild and Window::next better to use from code? Like from for() loop?

I also see that I did not update it with Box class...I was using Update(null); at first, but now I really like the Update(myBox); :) especially when I did not understand why only a half of number was drawn, but other half not :) (forgot to update the size of box) :lol:
Also I get some left over slide bars drawn
I do not see this...It is just sliding... :/

I will do some more work on it and then re-post the control with entire project..hopefully it will be fully functioning.

Thank you,
D.Bane.
Author:  jerome [ Thu Sep 08, 2011 10:38 pm ]
Post subject:  Re: CommonControl issues

D.Bane,

For git, you could try the other fetch protocol. There's git and http...

git://git@github.com:ecere/sdk.git
https://github.com/ecere/sdk.git

About the error on the Documentor building the SDK, checkout this post. It is because we're temporarily using gettext/libintl and you're missing those MinGW packages.

I'm glad you like the new looks. I changed to a darker scheme 'cause I was having migraines with the white background :cry:. The look is also a bit more configurable, we centralized all the code at the top of ide/src/Designer/CodeEditor.ec. If you have the Consolas font, you can select that there instead of Courier New for example (You can get it free with the download of Visual Studio Express).
Line numbers -- I guess you had not updated in a while :)

The top window border: the IDE is using the native decorations by default. If you have Windows 7 this looks pretty good with the translucency =) Of course the XP ones doesn't look as good, and the 'Windows classic' look would give you your familiar Win2k Ecere look without even modifying the code. You can still go back (mostly) to the previous decorations by disabling the 'nativeDecorations = true' calls in the IDE. Git is useful to keep local modifications (e.g. to CodeEditor.ec) while still updating the code. I actually updated the default non-native decorations to a different silver gradient, you might like it. The buttons are shiny as well now ;)

There has been a lot of other changes in Ecere of course, these visual tweaks are just some minor tweaks :)

About the slider, I believe the crash you were getting is probably because the code was not compiled, and it was not meant to be added to the ToolBox. In a sense the bug is probably fixed, by not adding it to the toolbox :P If you compile it as a DLL that is in your path (e.g. in Ecere SDK/bin), and then import it (and set an icon for it, and of course it derives from CommonControl), you should then be able to use it from the ToolBox! (Without a crash, hopefully :))

Update(null) just means the window's entire client area. It's the same as:
Update({0,0, clientSize.w-1, clientSize.h-1})

Yes you use firstChild and next in a for loop to go through the window, but I'm not sure what exactly you're trying to do... CycleChildren() is for making the next or previous child active. (activeChild/activeClient).

Regards,

Jerome
Author:  D.Bane [ Fri Sep 09, 2011 6:26 am ]
Post subject:  Re: CommonControl issues

Hi Jerome,

Thank you for the very nice and detailed info on what I need to do now. I also see that Sam has asked some very nice questions so I am packed for a while now :)

I had given up on MS Studios and what ever...It was easy to do a lot in VB, but Ecere is a beauty that is far more superior and I want to stick with it :)

I like that you can do anything, but in vb you would need to do some serious.... to be able to do something cool looking, etc..

Yea...I had little time so when I got to it, I used the version already installed..But now I am using this great new version so it is maybe even better this way..It gives me more enthusiasm about working with Ecere.

About those migraines...The green (a bit darker variant) has been proven to relax the mind and allow people to learn more easily...That is why the blackboards were of the green color...Imagine white..students would go crazy on the teachers :)

I now use Box class to update..When I was first time reading the TAO it was, ok, this is not important for now, but then I went back and thought more about it and it works beautifully. I find it great, the idea of updating only one part of the screen, instead of everything.

I will use cycle to disable or hide any buttons that are positioned on the slider control, and use it also to automatically set the positions of the controls if the placement of the slider is moved.

Thank you and best of luck,
D.Bane.
All times are UTC-05:00 Page 1 of 1