Button title with newline

Hey all,

This is probably a really stupid question, but anyways:

*WeatherButtons: (1x1 Frame 0, Title "foobar" )

What if I want the Title to be on two lines?
Instead of

I would want

any ideas?

/J

You cannot achieve that to my knowledge. I don’t think any WM I’ve seen has the ability to display a newline in window title. I can’t think of a reason why they should, then again, can’t think of a reason they shouldn’t. :slight_smile:

ok… maybe I’m going about this the wrong way.

What I am trying to do is create a “button” that will display weather data in a format like:

(like weekday)

…I was trying to do this with the Icon and Title keywords to a button. Maybe I should “swallow” a whole app to do this?

Is anyone else doing this? if so, how?

/J

Ooops. I totally misunderstood what you were asking :blush:
Sorry about that.

Yes, ofcourse you can have that.

For static definition, or for output of scripts etc.

*FvwmButtons: (Title “Weekday”)
*FvwmButtons: (Icon cloudy.png)
*FvwmButtons: (Title “Temparature”)

If swallowing an application:
*FvwmButtons: (Swallow (UseOld) “app_class/name/resource” “what to execute”)

For further information, consult ‘man FvwmButtons’

But iirc, there are also nice almost-ready-to-run FvwmScript solutions floating around, you might want to run a search for “weather” in here to find them.

cool! Thanx!

I’ll give this a try as soon as I get a chance to.

I think what I originally wanted was to have all three things in one button. (title, icon, title) – but if that doesnt work, I guess having them in separate buttons should be ok.
But then I’ll need one swallowed FvwmScript to change the title of a button it is not swallowed into. How would I do that?

/j

You can’t spread the title of a button across new-line boundaries.

Within a Do {} action in your FvwmScript, call a function or somesuch that invokes SendToModule on the specific button, see:

edulinux.homeunix.org/fvwm/fvwmc … aq.html#M1

– Thomas Adam

Hey!

I have a line in my fvwmscript that looks like this:

SendToModule WeatherButtons ChangeButton "A" Icon /home/ja/.fvwm/icons/weather_icons2/12.png

…but nothing happens. Is this the correct way? It works fine when I run it in FvwmConsole. Is there are different way of doing this from inside a FvwmScript?

/J

Ideally, I’d add “/home/ja/.fvwm/icons/weather_icons2” to your imagepath as in:

ImagePath $[FVWM_USERDIR]/icons/weather_icons2:+

and then do:

SendToModule WeatherButtons ChangeButton "A" Icon 12.png

– Thomas Adam

Hello again…

Maybe you can help in figuring out why this doesnt work:

[code]WindowTitle {FvwmApplet-WeatherStatus}
WindowSize 125 20
Font “xft:daniel:size=14”

Init
Begin
Set $MainColorset=(GetScriptArgument 1)
If $MainColorset <> {} Then
Begin
ChangeColorset 0 $MainColorset
ChangeColorset 1 $MainColorset
End
Set $tmp = (GetOutput {exec grep ‘^CURR_TEMP:’ ~/.weather.out | sed ‘s/^CURR_TEMP: //’} 1 -1)
SendToModule WeatherButtons ChangeButton A Icon /home/ja/.fvwm/icons/weather_icons2/26.png
ChangeTitle 1 $tmp
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 5)==0 Then
Begin
Set $old = $tmp
Set $tmp = (GetOutput {exec grep ‘^CURR_TEMP:’ ~/.weather.out | sed ‘s/^CURR_TEMP: //’} 1 -1)
If $tmp==$old Then
Do Nop
Else
Begin
ChangeTitle 1 $tmp
End
End
End

Widget 1
Property
Position 0 0
Size 125 20
Type ItemDraw
Flags NoReliefString[/code]

Shouldn’t the “SendToModule” run when the script starts??? It doesnt seem to do anything when this script starts, but if I cut and paste it into a console it does what I’d like it to…

:blush:

As I said in my initial post, you have to put it in between a Do {…} statemnent for it to be sent to FVWM.

– Thomas Adam

:blush: --thanx – I didnt understand that initally.

How about this:

Do {SendToModule WeatherButtons ChangeButton B Title $currcond}

…seems like its sending ‘$currcond’ (and not the value of $currcond) to WeatherButtons…
Would the best way to address this be to define a new function or is there an easier way to do it?

I can’t see an easy way around this, other than to test for it:

If $curtitle =={something} Then
  Do {SendToModule ...... Title "Some Title"}
Else
   Do {.....}
End

I don’t know much about FvwmScript at all. Sorry.

– Thomas Adam

I posted this in a new topic

viewtopic.php?t=1361