How to setup a menuitem for input into editor? solved

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

How to setup a menuitem for input into editor? solved

#1 Post by oldyeller »

Hello Everyone,

I have been trying for last 2hrs too take the menuitem so that it inputs a file into the editor for reading.

Code: Select all

<menu label="_Timelines" use-underline="true">
	<menuitem stock-id="gtk-open" label="1">
	   <action>cat > '$WORKDIR'/001 > '$WORKDIR'/reading</action>
		<action>refresh:EDITOR</action>
		</menuitem>
	
	</menu>
If I need to show all the code let me know and I will post that as well.

Thanks for any help

Cheers
Last edited by oldyeller on Fri 22 Feb 2013, 08:16, edited 1 time in total.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#2 Post by SFR »

Hey Oldyeller

The first > is unnecessary, should be cat '$WORKDIR'/1 > ...

Just in case - a stand alone example. :wink:

Code: Select all

#! /bin/bash

WORKDIR=/tmp
echo "blablabla" > $WORKDIR/reading
echo "completely different blablabla" > $WORKDIR/1

export MAIN='
<window>
  <vbox>
    <menubar>
      <menu label="_Timelines" use-underline="true"> 
        <menuitem stock-id="gtk-open" label="1"> 
          <action>cat '$WORKDIR'/1 > '$WORKDIR'/reading</action> 
          <action>refresh:EDITOR</action> 
        </menuitem> 
      </menu>
    </menubar> 
    <edit>
      <variable>EDITOR</variable>
      <input file>'$WORKDIR'/reading</input>
    </edit>
  </vbox>
</window>
'

gtkdialog -p MAIN
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#3 Post by oldyeller »

Hi SFR,

Will give it a try with the rest of my code.

Will this allow me to use a input file with the information that I want displayed or will I need to type it in for the echo as you did for the example.


Cheers

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#4 Post by SFR »

Yes, I just used 'echo' to make sure that input files for <edit> do exist and are not empty.
It will work with any textual files.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

Post Reply