Re: Unified libraries to allow porting code to other oses

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

Create your widgets with wxCreate instead of create, and you will be able to use the same function to set widgets text instead of many. These lines:

  set_label(frame, "Clicked") 
  set_label(button, "Clicked") 
  set_label(lbl, "Clicked") 
  set_label(radiobox, "Clicked") 
  set_label(combo, "Clicked") 
 
  set_status_text(sb, "Clicked", 0) 
 
  set_text(sle, "Clicked") 
 
  set_string(list, 0, "Clicked") 
 
  set_string(choice, 0, "Clicked") 
  set_choice(choice, "Clicked") 
 
  set_cell_value(grid, "Clicked", 0, 1) 

can be replaced by those lines:

  setText(frame, "Clicked") 
  setText(button, "Clicked") 
  setText(lbl, "Clicked") 
  setText(radiobox, "Clicked") 
  setText(combo, "Clicked") 
 
  setText({sb,1}, "Clicked") 
 
  setText(sle, "Clicked") 
 
  setText({list,1}, "Clicked") 
  setText({choice,1}, "Clicked") 
  set_choice(choice, "Clicked") 
 
  set_cell_value(grid, "Clicked", 0, 1) 

You still have access to wxEuphoria standard functions. Simple functions are designed for people who migrate from one OS to another, from one GUI to another, with few knowledge of the intended target. Advanced users can use standard functions.

Regards

Jean-Marc

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.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu