Ecere SDK/eC Forums https://ecere.org/community/ Print view |
|
String Property issue https://ecere.org/community/viewtopic.php?f=1&t=204 |
Page 1 of 2 |
Author: | samsam598 [ Tue Oct 11, 2011 3:21 am ] |
Post subject: | String Property issue |
Below example is an eC question than a networking program although the main code is regarding networking under win32.As I have very poor knowledge to networking program,I did some execises under windows with win32 API. The problem I encountered is that I defined a string field and string property 'hostInfo' in Form1,when I test,it turned out that the property 'hostInfo' actually did not get its data.Pelase refer to below code. char* GetHostInfo() read from the OS and get the host_name/host_address ,then combine them into a String.When I build the hostInfo property,I use this GetHostInfo() function to get the host information and build the hostInfo's getter.The issue is that in the client code,using GetHostInfo to show the host information is workable but it isn't if using hostInfo.It would be gratefulf if you can figure me out what I did wrong. EDIT:just noticed that in (w)sprintf(result,"bla\tbla\t",...) the '\t' does not make sense in GUI.Is this normal? Code: Select all
|
Author: | jerome [ Tue Oct 11, 2011 12:38 pm ] |
Post subject: | Re: String Property issue |
Hi Sam! Good to hear back from you You are right, the hostInfo property is not invoked in your code. That is because you are accessing 'hostInfo' from 'within' your class, and data members have priority over properties within a class (you have a data member with the same name, so it uses that instead). To force the property from being called from within a class, you can access it as property::hostInfo as such: Code: Select all
I'm not sure I understand what you are asking about the '\t' character? Are you asking what the Ecere GUI / graphics engine does when it encounters that? Different situations will handle it differently. In the popup menus, it can be used to position hot keys hints at the far right. In the EditBox, tabs are handled as spacing characters (with options to 'insert tabs' or 'use spaces' instead). The Surface::WriteText function (and anything else that relies on it) will display the character which is defined for it in the font. Also I can't help but suggest you use the Ecere functions instead of the WinSock API directly, to fulfill Ecere's aspiration for cross-platform applications: GetAddressFromName, GetNameFromAddress and GetHostName will help you do what you're doing here with much ease. Regards, Jerome |
Author: | samsam598 [ Tue Oct 11, 2011 8:34 pm ] |
Post subject: | Re: String Property issue |
I did not leave.I am living here Besides I was crasy busy on my work recently,I am learning networking and threading program but it seems that the progress is very slow.Really missing the Dao and expect it covers these topics asap. Got it,so property can have a different name to the field it reflects?For example,if there is a field int m_age,I can define property age rather than m_age?I've been thinking that I can only define m_age as property. Given below code Code: Select all
Code: Select all
Yes,and this is what I always expect I can do some day.As I've mentioned I have very poor knowledge (almost zero) on networking and threading program.There are too many thing I need to learn to understand how they are working.If I can program networking and threading in eC using eC's portable library,it would be great. After been playing with eC these days,I consider it as a serious and very powerful tool built on top of C and provides quite a few of rich features.Many of these I love so much.I have learnt about quite a few other languages,but this is one of the most I love.Also I have a couple of suggestions,or wish list here on eC's development priorities in the future: 1.Bugfix,bugfix,bugfix.I am willing to be the white rat as I am loving to learning everything in eC.And the great thing I can say during the past experience I use eC,it is quite stable now. 2.Document.Based on my experience,reading sample program in the SDK can answer my question,but not eveytime.I do know doc need plenty of time,but I wish one can get detailed information and step to step guide throug examples for somce advanced features in eC,such as generics,containers,networking and threading,2D and 3Ds. 3.Enrich the libraries.I would like to see a complete set of libaries like 2D drawing,encryption,chart and databases,xml,regex,just to name a few.Of course I know Roman was not built in one day,but I can wait. 4.IDE extend.more GUI component controls,say EditBox support masks(password char="*"),Date/DateTime EditBox,EditBox support validating,etc,just to name a few;plug-in support(some thing like dephi/lazarus),one can contribute his own favorite components to eC SDK. Regards, Sam |
Author: | jerome [ Tue Oct 11, 2011 9:40 pm ] |
Post subject: | Re: String Property issue |
Hey Sam, Yes, a property can be named anything. It is a completely separate object, it could even set/return a value that is not at all stored in a data member. I just prefer using the same name for both, for clarity. I do not like variable prefixes like m_age But that's just me. About '\t', as I explained, GUI elements would actually require special handling code to do anything with it, and with variable width fonts it would be rather bothersome. Consider aligning things by using separate labels and using anchors. I am quite confident the Ecere networking library can do everything you need, in a portable manner. I agree on those priorities. I'm not sure if you took a look at our current (somewhat outdated) roadmap. A few of those deadlines have already passed by and time is running out on the other ones It kind of reflects the bug fixes & documentation goal, which is what we're focusing on (when we have time ). About 3 and 4... I think many of those are at least partially implemented already, so I'll try to show you how to use them!
Regards, Jerome |
Author: | samsam598 [ Wed Oct 12, 2011 12:57 am ] |
Post subject: | Re: String Property issue |
Noted with thanks. Very glad to hear that. Fully understood and really appreciated! Yes I know,I know.I did not mean eC is lack of such libraries,actually people like me come here and using eC is coz eC has already provided a very powerful and rich library set which let us can do a lot. Yes,something like that,and more.I think with 2D library we can draw pies and candles charts like stock history,etc,hope you know what I try to say.What's more,we can do some 2D paint stuffs like photoshop.At the last point maybe it is more suitable to do in 3D,but I am just not sure. Glad to know.So one more topic I need to learn Exactly. Yes I knew,and it is really cool.I am studing it.My prevois post in this thread "a complet set" just mean "complete". Two more to learn. Cooool!Is it possible to prohibit copying the content from within the PasswordEdit? No,I mean another thing.If you are familar with Delphi,you should know what I mean.In a DateEdit,it marks as __/__,you can only input valid number to build a date,and no need to type '/' in it.Maybe it is not a must-have component,just an example for " other more components". Great! BTW,I noticed there is a thread named 'eC for the Web and JIT compiling with TCC ',what's that?web programming in eC?If yes,this is also the one I would like to see in eC. Regards, Sam |
Author: | jerome [ Wed Oct 12, 2011 10:19 am ] |
Post subject: | Re: String Property issue |
Sam, About drawing Paint stuff, that functionality would usually be implemented as software drawing (directly setting pixel values in a memory buffer, by using a Bitmap object) for that purpose, and would best belong in a separate library (most GUI applications will not require this). e.g. there is a FloodFill sample in samples/guiAndGfx. For Pie charts, they are indeed all 3D these days For real-time drawing, even 2D things are usually drawn using 3D accelerated APIs like OpenGL and Direct3D nowadays. Right now this can be done through the Display and PrimitiveSingle interface, but I'm hoping to make all this functionality more accessible in the future. Prohibiting copying the content from the PasswordEdit: certainly you could do this. You could hook OnKeyHit, and only chain to EditBox::OnKeyHit if the key is not ctrlC and Control-Insert (Key { insert, ctrl = true }). You could also hook OnRightButtonUp to prevent the right-click menu from popping up. About your Date edit, the current DateTime editor is quite powerful, letting you enter a date in a lot of different ways. If you want something specific, you can easily implement it yourself. This is usually done by overriding the OnEdit/OnDisplay/OnSaveEdit/OnGetDataFromString/OnGetString methods of your data type (e.g. you can define a class that inherits from Date, e.g. SamDate) and then spawn your own control that edits the data the way you like it. That is the way to do it if you want your own editor to work in all Ecere data controls (e.g. ListBox, DropBox, SavingDataBox). You could also simply create your own control that works the way you like it, using the existing data types. Yes, web programming in eC, we hope to make that possible some day -Jerome |
Author: | samsam598 [ Wed Oct 12, 2011 7:50 pm ] |
Post subject: | Re: String Property issue |
Noted with thanks.I also noticed that the focus can not leave the PasswordEdit control after some actions taken in a button control,for example if the user enter a wrong password.In my program below,I would like the enter focus on the EditBox edtName (the first one) but could not make it.How can I fix this? Code: Select all
|
Author: | jerome [ Wed Oct 12, 2011 8:34 pm ] |
Post subject: | Re: String Property issue |
Hi Sam, I'm a bit confused by your question, but let's see if I understand it properly. First of all the caret in the PasswordEdit box is not working. It's somehow related to the box being not high enough, so if you set a height of 26 or higher for the size it fixes it. That makes it easier to see when the box is active and when it's not. Then, the way 'default' buttons work is that they re-activate the control which was last active when Enter was pressed. So if you are on the PasswordEdit, it will remake the PasswordEdit active, and I personally think that's fine, because people would usually make mistakes on the password (which they cannot see) rather than in the username (which they see). But if you insist on always reactivating the userName instead, here is some code that will do it: Code: Select all
-Jerome |
Author: | jerome [ Wed Oct 12, 2011 9:59 pm ] |
Post subject: | Re: String Property issue |
Sam, There were still some issues with the solution I proposed above:
Here is some code that in effect implements its own 'default' control behavior, by using the OnSysKey* methods, to intercept the Enter key before it gets to the default control system: Code: Select all
|
Author: | samsam598 [ Wed Oct 12, 2011 10:11 pm ] |
Post subject: | Re: String Property issue |
Hi Jerome, Thank you so much for your time to taking care of this! Regards, Sam |
All times are UTC-05:00 | Page 1 of 2 |
Powered by phpBB® Forum Software © phpBB Limited |