Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 23 Oct 2014, 14:36
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
What should the data returned from a function library be?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [1 Post]  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Mon 26 Apr 2010, 20:37    Post subject:  What should the data returned from a function library be?  

There`s a lot of ways to return and use data from functions, the easier to use the better.
My function library can be sourced, or the library executed and the functions called.
I have most all of the functions doing a search and match for partial Xwin. titles.
I`ve gotten the functions to return just values, variable assignments, or evaluated variables.

Some functions return $X, $Y, $W, $H, and maybe the $ID and $TITLE.
Evaluated variables seem the best method here as you know the names of the variables
Also the variables are ready to use and don`t have to be assigned or other code written.

However one of the functions returns info on all the gtkdialog GUIs running.
To evaluate all of the info returned would make for a lot of variables ( 6 per GUI ).
But there`s no way to know what the variables are called as there`s no input arguments.
### Q: Way to get the variables added to the current shell? Command "env" doesn`t do it.
I thought of returning a variable list of the GUI titles which are prepended to the variable names.
Then you could search the list for a match and know the names of each GUIs variables.
But this seems more complex than is needed.
Here it seems best to return a line of values for each gtkdialog GUI running ( the simple way ).
Then the following code can pick out the line it wants and then can parse and use it`s data.

I thought I`d try for a consensus on outputs and maybe even the function names.
Functions so far:
gtkinfo() ... Get info on all gtkdialogs GUIs running.
scrnres() ... Get resolution of desktop / screen.
xtitle() ....... Find the full Xwin. title from part of the title ( validation and auto. completion ).
guiinfo() ... Get info on a GUI by it`s Xwin. title ( perhaps it should do it by ID also ).
dock() ....... Dock a GUI to the right of a running GUI if possible, otherwise on the left.
over() ....... Position a GUI over a running GUI with offsets to line up it`s position.
center() ..... I know that gtkdialog will do this with: ---center , but I included it to be concise.
Along with Screen center, maybe dock to Screen: Left, Right, Top, and Bottom.

I`ve tried to make the library gather as much info by itself as possible, more can be done...
If a child GUI is popped up briefly off screen then it`s size ( W, H ) can be gotten.
gtkdialog doesn`t seem to be any way to have truly hidden or invisible controls and windows.
And if possible I`ll add a function to get the displayed width of a string of text ( idea above ).

Any feedback, suggestions, ideas, or donated code is the whole idea of this post...
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [1 Post]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0436s ][ Queries: 12 (0.0073s) ][ GZIP on ]