Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Twapi : Help button

74 views
Skip to first unread message

Nicolas Robert

unread,
May 2, 2019, 5:27:53 AM5/2/19
to
Hello ,

I would like to know if it's possible to add a help button with twapi like this :
https://ibb.co/BZRfWMB

Thank you

Nicolas

Ashok

unread,
May 2, 2019, 6:44:40 AM5/2/19
to
The following should do it

twapi::configure_window_titlebar $hwin -contexthelp 1 \
-minimizebox 0 -maximizebox 0

where hwin is the toplevel window handle. Note -minimizebox/-maximizebox
must be set to 0 (that's a Windows limitation).

However, I'm not sure the above is useful as I don't know how to get a
click on the button to invoke code in your application.

An alternative, if you are using Tk, might be to use a [place] command
to overlay a help button image appropriately in the title bar but I'm
not sure how feasible it is to figure out the exact position it would
need to be placed.

/Ashok

Ralf Fassel

unread,
May 2, 2019, 7:54:06 AM5/2/19
to
* Ashok <pal...@yahoo.com>
| An alternative, if you are using Tk, might be to use a [place] command
| to overlay a help button image appropriately in the title bar but I'm
| not sure how feasible it is to figure out the exact position it would
| need to be placed.

Is the titlebar inside the region where 'place' can put widgets?
I always thought the titlebar is 'outside' of the Tk toplevel, and the
part of the 'placed' widget which falls outside of the Tk toplevel is
not visible...

R'

Ashok

unread,
May 2, 2019, 8:43:49 AM5/2/19
to
Hmm...I think you are right. I was remembering placing a widget above
another widget and thinking you could do the same with the toplevel but
it probably won't be visible.

I guess then the other option is to create a toplevel with the image and
place it within the title bar using [wm geometry] if possible or twapi's
move_window. That's probably quite a bit of work to get working. Then
again, my Tk knowledge is only at the level of a dabbler.

/Ashok

Nicolas Robert

unread,
May 2, 2019, 9:59:00 AM5/2/19
to
Le jeudi 2 mai 2019 12:44:40 UTC+2, Ashok a écrit :
> The following should do it
>
> twapi::configure_window_titlebar $hwin -contexthelp 1 \
> -minimizebox 0 -maximizebox 0
>
> where hwin is the toplevel window handle. Note -minimizebox/-maximizebox
> must be set to 0 (that's a Windows limitation).
>
> However, I'm not sure the above is useful as I don't know how to get a
> click on the button to invoke code in your application.

Thanks Ashok , it was in the help I didn’t see sorry... you are right , when I click on the button nothing happens . I thought I could modify (wm protocol) and use
wm protocol . WM_HELP {
# my code
}
I now think I will use the <F1> key to display my Html page

Nicolas

Harald Oehlmann

unread,
May 2, 2019, 10:52:41 AM5/2/19
to
I the long run, Tk may be extended to support the help icon and bind it
to a virtual event. You may consider to write a TIP on that.

Thank you,
Harald

Nicolas Robert

unread,
May 2, 2019, 11:35:32 AM5/2/19
to
Le jeudi 2 mai 2019 16:52:41 UTC+2, Harald Oehlmann a écrit :

> I the long run, Tk may be extended to support the help icon and bind it
> to a virtual event. You may consider to write a TIP on that.
>
> Thank you,
> Harald

I have to follow this procedure ?
https://core.tcl.tk/tips/doc/trunk/doc/help.md

thanks

Nicolas Robert

unread,
May 2, 2019, 4:26:34 PM5/2/19
to
Ashok,

I am able to know where is located my "help button" with twapi::get_mouse_location & twapi::get_window_coordinates HWIN

Now I would like when I pressed MB1 be able to execute a script.
In the documentation there is <twapi::register_hotkey HOTKEY SCRIPT ?-append?>

Can you confirm that this function only works with keyboard inputs ? and not mouse input...

I looked at https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes and for Left mouse button it's {0x01} but it doesn't work (twapi::register_hotkey {0x01} my_script)

Thanks

Nicolas

sled...@gmail.com

unread,
May 2, 2019, 4:46:43 PM5/2/19
to
In as much as you want to customize 'window' functionality, why not effect an wm "override" and then you can implement whatever ui controls you desire.
Create your own title bar, etc...
Thats what we do...

sled...@gmail.com

unread,
May 2, 2019, 4:49:53 PM5/2/19
to
Use wm override, then construct what ever haptic driven functionality you desire. We use tcl\tk to construct simulacrums of various desktop UI. It is a lot easier to construct and manage the 'override' environment than to 'override' MS Windows.

Just sayin

two...@gmail.com

unread,
May 3, 2019, 11:54:50 AM5/3/19
to
On Thursday, May 2, 2019 at 1:49:53 PM UTC-7, sled...@gmail.com wrote:
> On Thursday, May 2, 2019 at 2:27:53 AM UTC-7, Nicolas Robert wrote:
> > Hello ,
> >
> > I would like to know if it's possible to add a help button with twapi like this :
> > https://ibb.co/BZRfWMB
> >
> > Thank you
> >
> > Nicolas
>
> Use wm override

Perhaps a bit clunky, but...

Combined with a second toplevel window that is also

wm attributes .helptop -topmost 1

one could place a very small window over the regular window
that binds to left mouse button.

It would probably depend on what movement or other actions might
be needed for the underlying window, so as to keep this control
window aligned, say if you move the underlying window.







Ashok

unread,
May 6, 2019, 2:10:21 AM5/6/19
to
Sorry, I don't know if the Windows hotkey API will work with mouse buttons.

/Ashok
0 new messages