Page 1 of 1

How to setup a menuitem for input into editor? solved

Posted: Thu 21 Feb 2013, 20:14
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

Posted: Thu 21 Feb 2013, 23:54
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!

Posted: Fri 22 Feb 2013, 01:20
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

Posted: Fri 22 Feb 2013, 08:23
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!