gtkdialog .0.8.5c

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
don570
Posts: 624
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 98 times

gtkdialog .0.8.5c

Post by don570 »

I wanted to force the user to click in an edit box to see a cursor prompt.
I found I could hide the cursor when launching a gtkdialog window using
a little trick--->

Squeeze an unused ENTRY widget to the left of window
and put "1" in entry field to make it as small as possible.
The result is light blue vertical line that can be hardly seen (see image)
Final project is " PUP Diary"
Here is some code to show how I did it...
Note that I used

Code: Select all

 space-expand="false" space-fill="false"

to squeeze the first entry widget.
The second widget is normal-sized to enter some data.

Code: Select all

<window    title="PUP Diary '$VERSION'" resizable="false">
<vbox>
 <hbox>    <text space-expand="false" space-fill="false">
            <label>"'$(gettext 'Window height')'"</label> 
            </text>
               <entry space-expand="false" space-fill="false" max_length="1"  width-request="1">                                                 
<variable>Fake_entry</variable> <default>1</default> </entry> <entry space-expand="false" space-fill="false" max_length="3" tooltip-text="'$(gettext 'Change the height of window')'" width-request="50">
<variable>Height</variable> <default>'`cat $WORKDIR/height`'</default> </entry>
Attachments
screenshot-pupdiary2.png
screenshot-pupdiary2.png (44.85 KiB) Viewed 477 times
Last edited by don570 on Fri Feb 02, 2024 10:24 pm, edited 1 time in total.
User avatar
MochiMoppel
Posts: 1116
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 359 times

Re: Hiding cursor in gtkdialog

Post by MochiMoppel »

don570 wrote: Mon Jan 29, 2024 10:03 pm

I found I could hide the cursor when launching a gtkdialog window using
a little trick

Looks like this doesn't work with modern gtkdialog versions as used in BW64 (see screenshot), however it brings up the more interesting question: How to force entry widgets to a smaller width than their default width in gtkdialog versions compiled for GTK3? I haven't found an answer. Forcing widget sizes is a real problem in GTK3.

As for your cursor hiding exercise: You don't need this - definitely not here and probably never ever. You could force the cursor to the edit box instead of letting gtkdialog take focus of the preceding entry box. Try <edit has-focus="true">

gtkdialogGTK3.png
gtkdialogGTK3.png (10.63 KiB) Viewed 431 times
don570
Posts: 624
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 98 times

Re: Hiding cursor in gtkdialog

Post by don570 »

Looks like this doesn't work with modern gtkdialog versions as used in BW64

Tested in fatdog64 and Easy OS
which have different versions of gtkdialog I guess??

The purpose of exercise was to show nothing selected and force the user to
click in the editor widget.

I'll try

Code: Select all

<edit has-focus="false">

in the widgets.


User avatar
MochiMoppel
Posts: 1116
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 359 times

Re: Hiding cursor in gtkdialog

Post by MochiMoppel »

don570 wrote: Tue Jan 30, 2024 10:56 pm

I'll try

Code: Select all

<edit has-focus="false">

in the widgets.

That's not what I suggested and doesn't make sense.

don570
Posts: 624
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 98 times

Re: Hiding cursor in gtkdialog

Post by don570 »

I looked at Thunor's examples...
There is one example explaining focusing
but focusing isn't useful to me
https://oldforum.puppylinux.com/viewtopic.php?t=82059


So I rearranged the widgets and made the PUPDiary package again.
It should be useful for people who know markdown language

screenshot-pupdiary.png
screenshot-pupdiary.png (35.45 KiB) Viewed 353 times
step
Posts: 510
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 50 times
Been thanked: 179 times
Contact:

Re: Hiding cursor in gtkdialog

Post by step »

<Fatdog sidebar start>
@don570, Fatdog provides both GTK2 and GTK3 versions. The GTK2 version is pre-installed. You can install the GTK3 version via package manager. If you do you will end up with the following files:

Code: Select all

/usr/bin/gtkdialog -> gtkdialog_gtk3
/usr/bin/gtkdialog3 -> gtkdialog
/usr/bin/gtkdialog4 -> gtkdialog
/usr/bin/gtkdialog_gtk2
/usr/bin/gtkdialog_gtk3

The last two lines are the actual binaries. Run your dialog with gtkdialog_gtk2. Then with gtkdialog_gtk3. You will see differences, as @MochiMoppel said.
There's also a package that installs gtkdialog documentation in /usr/share/doc/gtkdialog-0.8.5. You get it when you load devx sfs or if you install package gtkdialog_doc via package manager.
<sidebar end>

don570
Posts: 624
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 98 times

gtkdialog 0.8.5c

Post by don570 »

Bookworm Pup64 has 'upgraded' its version of gtkdialog

Bookworm Pup64 10.0.1 Changelog
• New Woof-CE build of BW64 including Debian 12.1 binary/security updates (thanks dimkr)
• New 6.1.38 kernel build (thanks dimkr)
• Update gtkdialog to 0.8.5c and WeeChat to 4.0.3 (thanks dimkr)

Quite a bit different from the fatdog64 version.
Old programs need to be modifieid. Combobox widget converted to comboboxtext widget
Thunor explained change in old forum...
https://oldforum.puppylinux.com/viewtop ... 95#p695709


step
Posts: 510
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 50 times
Been thanked: 179 times
Contact:

Re: gtkdialog 0.8.5c

Post by step »

don570 wrote: Wed Jan 31, 2024 10:24 pm

Quite a bit different from the fatdog64 version.

It's the same major version that Fatdog64 provides. The difference you're seeing is entirely due to the GTK version, 2 vs 3, not to the gtkdialog version (which is the same). This post https://forum.puppylinux.com/viewtopic. ... 02#p110702 details the GTK2 and GTK3 packages available in Fatdog64.

don570
Posts: 624
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 98 times

gtkdialog 0.85c

Post by don570 »

gtkdialog 0.8.5c
Two differences I have seen

1) COMBOBOX widget is ignored
2) ENTRY widget width can't be changed
https://oldforum.puppylinux.com/viewtop ... 6f#p695709


User avatar
01micko
Posts: 134
Joined: Mon Jul 13, 2020 4:08 am
Location: Qld
Has thanked: 5 times
Been thanked: 63 times
Contact:

Re: gtkdialog 0.85c

Post by 01micko »

gui.png
gui.png (10.25 KiB) Viewed 221 times
don570 wrote: Fri Feb 02, 2024 10:23 pm

2) ENTRY widget width can't be changed

It can. I'll let this script do the talking - runs in gtkdialog compiled with 2 or 3 gtk lib, with a switch for recent woof builds, so should run OOTB in bookworm64 which has gtkdialog(gtk3) and gtk2dialog(gtk2). The script is basically your snippet from the OP with the cli switch to run either.

In the gtkdialog wiki there are links to GTK3 widget descriptions including properties for each widget.

Code: Select all

#!/bin/sh
VERSION=XXX
case $1 in
	2)G=gtk2dialog
	E='max_length="1"  width-request="1"'
	L=max_length;;
	*)G=gtkdialog
	E='visible="false" has-focus="true"'
	L=width-chars;;
esac
echo '<window    title="PUP Diary '$VERSION'" resizable="false">
<vbox>
 <hbox>    <text space-expand="false" space-fill="false">
            <label>"'$(gettext 'Window height')'"</label> 
            </text>
               <entry space-expand="false" space-fill="false" '$E'>                                                 

          <variable>Fake_entry</variable>
          <default>1</default>
          </entry>
          <entry space-expand="false" space-fill="false" '$L'="3"  tooltip-text="'$(gettext 'Change the height of window')'" width-request="50">                                                 

          <variable>Height</variable>
          <default>222</default>
          </entry> 
  </hbox>
 </vbox>
 </window>'| $G -s
don570
Posts: 624
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 98 times

Re: gtkdialog .0.8.5c

Post by don570 »

thanks for info


Post Reply

Return to “Programming”