Author Topic: Autohide Toolbar  (Read 9939 times)

zedd151

  • Member
  • ****
  • Posts: 871
Autohide Toolbar
« on: September 02, 2015, 07:15:58 AM »
I have been playing around with creating an autohide toolbar.

This little program will demonstrate several things.

First, rolling your own vertical toolbars.

Make them at least semi-automatic; there are narrow (6 pixels) wide static controls of
either side of the main window. Click on either one, and a toolbar opens.

There are a few buttons on each toolbar. Click on any button, the toolbar closes.

Very simple to achieve.

The other thing this program demonstrates is changing the background color and text
color of a rich edit control.



Latest example attached, source code included in the attachment




vertical toolbar example
« Last Edit: July 20, 2018, 04:01:58 AM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 871
Re: Autohide Toolbar
« Reply #1 on: September 03, 2015, 11:36:34 AM »
See first post of the thread for the example - source code included

in the attachment (vertical3a.zip)

« Last Edit: September 25, 2015, 10:35:51 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Autohide Toolbar
« Reply #2 on: September 04, 2015, 04:36:31 AM »
i think i've shown you my divider window example
in it, i used "mouse capture" and the WM_CAPTURECHANGED message
that would be one way to get what you want (probably how i would do it)

http://masm32.com/board/index.php?topic=2977.msg31084#msg31084

zedd151

  • Member
  • ****
  • Posts: 871
Re: Autohide Toolbar
« Reply #3 on: September 04, 2015, 04:55:39 AM »
See first post of the thread for the example - source code included

in the attachment (vertical3a.zip)

« Last Edit: September 25, 2015, 10:36:23 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Autohide Toolbar
« Reply #4 on: September 04, 2015, 05:29:44 AM »
ok - let's try this....

rather than using GetWindowRect, use GetClientRect
see if it changes when the toolbar is animated

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Autohide Toolbar
« Reply #5 on: September 04, 2015, 05:33:10 AM »
i've never played iwth AnimateWindow
primarily, i suppose, due to all the problems reported in the communty section on MSDN - lol

but, i'm sure we can figure it out

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Autohide Toolbar
« Reply #6 on: September 04, 2015, 05:51:52 AM »
Code: [Select]
INVOKE  GetWindowLong,hWnd,GWL_STYLEthe result in EAX should have the WS_VISIBLE bit set when the window is showing

still researching....

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Autohide Toolbar
« Reply #7 on: September 04, 2015, 06:06:03 AM »
wow - with all the problems reported, i'd be tempted to animate the window(s) myself
you can roll your own animation, so that both windows "roll" together

zedd151

  • Member
  • ****
  • Posts: 871
Re: Autohide Toolbar
« Reply #8 on: September 04, 2015, 06:47:58 AM »
You know dave, I'm just tempted to leave it as is.

I mean so what if the toolbar covers a small part of the richedit control.

The toolbar will automatically hide itself once any button therein is pressed anyway.

So I think that is how I will proceed....

I won't post in this thread again until I have a working (somewhat) example to post.

I could as you say 'roll my own' also. That option is always there. I just liked the automated

'AnimateWindow' for it's simplicity (from the outside, anyway).
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 871
Re: Autohide Toolbar
« Reply #9 on: September 04, 2015, 06:55:25 AM »
I think I have a tentative solution. Not very elegant, but I think it should work...

Since I click on a 'gripper' (see example in attachment above in post #4) to open the toolbar via a timer,

why not also have the richedit control simply jump to the toolbar 'opened' position, once the toolbar is completely open?

Like I said, not as elegant as having the richedit 'slide' into position adjacent to the opened toolbar,

but for practical purposes it should work.

Anyway as I have said again, this project is basically on the back burner for now. I have work to do

making my plugin builder a plugin itself. - more on that later in another thread.
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 871
Re: Autohide Toolbar
« Reply #10 on: September 05, 2015, 01:18:44 PM »
I have another idea regarding the 'Autohide Toolbar'. I'm currently working one that I hope to make

generic enough so that the user can specify top, left, right or bottom for the toolbar location.

Right now I am simply experimenting but am hopeful to have a working example soon.
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 871
Re: Autohide Toolbar
« Reply #11 on: September 05, 2015, 06:25:08 PM »
I have another idea regarding the 'Autohide Toolbar'....

generic enough so that the user can specify top, left, right or bottom for the toolbar location.

 ::)  Yeah, sure. When pigs fly!

So much for my bright ideas. Anyway I attempted the same feat using 'SetWindowPos' this time, basically

with the same results. I have truly given up this time. Not that I haven't made the toolbars and they are at least

semi-automatic, I am just not satisfied with the results. I'll just stick with a couple of tried and true toolbars

for now. ....

Possibly forever. lol  :(

This task was much harder than I thought it would be. Maybe I should take up VisualBasic. lol  ::)
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

rrr314159

  • Member
  • *****
  • Posts: 1382
Re: Autohide Toolbar
« Reply #12 on: September 06, 2015, 12:40:33 AM »
Quote from: Richard Nixon
Winners never quit, and quitters never win

Quote from: Bill Gates
I created Visual Basic because I hate real programmers
I am NaN ;)

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Autohide Toolbar
« Reply #13 on: September 06, 2015, 01:26:32 AM »
i know how i'd do it   :biggrin:

start with a small tool window, say 2 to 4 pixels wide - something like that
WM_MOUSEMOVE - when the tool window proc gets this message, begin expansion of the tool window
capture the mouse - that means that all mouse messages come to this window proc until you release capture
that way, you can test to see if they left the window

once they leave the window, release capture
that will send a WM_CAPTURECHANGED message => begin contraction of the tool window

use BeginDeferWindowPos/DeferWindowPos/EndDeferWindowPos to handle size of the windows and controls

zedd151

  • Member
  • ****
  • Posts: 871
Re: Autohide Toolbar
« Reply #14 on: September 06, 2015, 03:12:12 AM »
Quote
Winners never quit, and quitters never win

I never REALLY quit.

Quote
I created Visual Basic because I hate real programmers

I was just kidding about VB. lol

Quote

..WM_MOUSEMOVE.....BeginDeferWindowPos/DeferWindowPos/EndDeferWindowPos......WM_CAPTURECHANGED..

 
Yeah, I had considered using mouse messages for activation.

There's probably a half dozen different ways.


I'll return to this at some point...
I'm not always the sharpest knife in the drawer, but I have my moments.  :P