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 17 Apr 2014, 11:47
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
HowTo get the number of pixels in a text string?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [9 Posts]  
Author Message
sunburnt


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

PostPosted: Fri 23 Apr 2010, 05:11    Post subject:  HowTo get the number of pixels in a text string?  

I`m trying to auto. set the width and height of PopMenus.
I have the height done, but the width is trickier of course.
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3276
Location: Oregon

PostPosted: Mon 26 Apr 2010, 02:03    Post subject:  

I seem to recall that one can use an option to set width and height with a character option rather than a pixel one.
But honestly, I cannot remember where I saw it.
But just maybe it was a geometry option.
Back to top
View user's profile Send private message 
sunburnt


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

PostPosted: Mon 26 Apr 2010, 04:18    Post subject:  

I was thinking a hidden textbox and get it`s width, crude but simple if it works.
The problem is <visible>false</visible> isn`t invisible in gtkdialog, it`s grayed out.
But pop up a textbox only GUI off screen, get it`s width and then kill it may work.
It`ll only be there a split second and it`ll be off screen so it`s not visible.

Update: I tested it and it will allow a GUI to be off the bottom of the screen just a little bit.
I think as the screen resolution changes the allowable off screen area moves with it.
And perhaps the area`s height expands and contracts in a ratio to the screen resolution.

It seems gtkdialog doesn`t like negative numbers for geometry, and X off right side of screen.
I`m at resolution 1024x768 ( can`t get it to go higher ), and X=900 is OK, but X=1000 nope.
But even though screen Y=768, Y=900 is OK, so I can hide the textbox GUI below the bottom.

Can anyone with their screen at a higher resolution please verify this?
Code for test textbox GUI:
Code:
#! /bin/sh
export TEXT_W="<window title=\"TEXTW\"><vbox>
  <text><label>0123456789</label><visible>false</visible></text>
</vbox></window>" ; gtkdialog3 -p TEXT_W +900+900 &

Change the second 900 (Y) at the last of the code to a bit more than your screen resolution Y.
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3276
Location: Oregon

PostPosted: Mon 26 Apr 2010, 13:56    Post subject:  

I tested on a screen resolution of 1280x1024 and the program was shown as running on the taskbar even though I could not see the window.
I set the Y value to 1050.
Also, you forgot "-G" in your code so no geometry settings were passed to the program.
Back to top
View user's profile Send private message 
sunburnt


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

PostPosted: Mon 26 Apr 2010, 14:30    Post subject:  

Yep, forgot to correct the pasted first code... I think this will probably work as needed.
It`s good it shows in the taskbar, easy to close it that way, but it`ll be "nolist" in jwmrc.
I think a general class for "nolist" that all gtkdialog GUIs can use. Like: -class NOLIST
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3276
Location: Oregon

PostPosted: Tue 27 Apr 2010, 01:07    Post subject:  

As to the Class and nolist, I tried at technasaurous suggestion to make a separate file containing the additions to be made to .jwmrc and then writing a little code that would put and include line in /etc/xdg/templates/_root_.jwmrc.
I tried it with a restart of JWM and it did not work.
The only way I could get the nolist to work for the DM window was just the way you did it.
Either I am missing something or just plain dumb!
There is commented lines at the start of the .jwmrc file that modifications should be made to the jwmrc configuration file.
But there are cautions there also.
So I am still at a loss as to the approved correct way to do it.

Still lost and still trying to learn!

Also, here is a thought.
Are all bash versions included with Puppy versions the same?
How does one check this?
I have heard comments on things being left out of bash when it is compiled to keep Puppy small.
Back to top
View user's profile Send private message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Tue 27 Apr 2010, 02:09    Post subject:  

8-bit wrote:
Are all bash versions included with Puppy versions the same?
How does one check this?
I have heard comments on things being left out of bash when it is compiled to keep Puppy small.


type busybox at the console

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
seaside

Joined: 11 Apr 2007
Posts: 878

PostPosted: Tue 27 Apr 2010, 15:36    Post subject:  

8-bit,

Quote:
I tried it with a restart of JWM and it did not work.


Did you run fixmenus?

Does the code work when placed in "/root/.jwm/jwmrc-personal"?

Cheers,
s
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3276
Location: Oregon

PostPosted: Tue 27 Apr 2010, 17:06    Post subject:  

seaside, Don't know, never tried putting it there.
Will have to get back to you on that one.
It would be interesting to know.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [9 Posts]  
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.0491s ][ Queries: 12 (0.0031s) ][ GZIP on ]