Re: Unified libraries to allow porting code to other oses

new topic     » goto parent     » topic index » view thread      » older message » newer message
irv said...

I'm not trying to be critical here, just constructive, so please don't take this the wrong way. From the two code snippets you show above, it appears that in order to port a program from one platform/gui to another, you're going to have to search and replace a LOT of code.

I believe that if you used an object-oriented approach, e.g.:

set(frame,"text","Clicked") 
set(button,"text","Clicked").... etc. 

then switching to another platform or gui would require no change in program code, except to include the desired wrapper. It would then be up to the author of the specific wrapper to implement the appropriate call, or provide an error message to tell the programmer that the particular call is impossible.

That would also allow the wrapper author to provide a work-around. For example, in GTK, buttons don't have a "text" attribute. They do, however, have a "label". It would be a simple matter to add that "alias" to the wrapper(s), so the same code

set(button,"text"...)

would run on wxWindows and GTK, or whatever.

The concept of the needed basic controls are the same for all platforms (window, label, button, image, list...) Those are already - or could be - implemented in all of the GUI packages, afaik.

I'm not sure I got the concept, but as I already built some kind of object-oriented library in Euphoria, I wilt try to go this way.

For the time being, I don't see what it will change but this could be more visible once tested.

Regards

Jean-Marc

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu