Page 2 of 3

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Thu Sep 05, 2019 2:11 pm
by Mesa
The icon "help" is not visible but it reappears when i comment this line
; ToolBar::TrackBar(#ToolBar, 100, 34, 0, 10, #TrackBar, "trackID", #PB_TrackBar_Ticks)


May i say, if you have the idea to use the tabgadget from STARGĂ…TE here
http://www.purebasic.fr/english/viewtop ... 12&t=47588
with you toolbar gadget, you should create a ribbongadget like that
https://docs.microsoft.com/en-us/window ... md-ribbons
:wink:

M.

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Sat Sep 07, 2019 10:49 am
by HeX0R
Mesa wrote:The icon "help" is not visible but it reappears when i comment this line
; ToolBar::TrackBar(#ToolBar, 100, 34, 0, 10, #TrackBar, "trackID", #PB_TrackBar_Ticks)
The help icon gets overwritten by the trackbar, change line 405 from

Code: Select all

Case #SpinGadget
into

Code: Select all

Case #SpinGadget, #TrackBar
And give the example window a little more width (640, instead of 600, line 1972)

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Sat Sep 07, 2019 12:02 pm
by Thorsten1867
Bugfixes

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Mon Jun 20, 2022 11:47 am
by tatanas
Sorry it's me again :?

A small change should me made concerning the buttons :
When you push down a button, behaviour is ok (background changes color and image shift a little) but when you release the button (_LeftButtonUpHandler()) it doesn't revert back the look of the button.

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Mon Jun 20, 2022 12:39 pm
by Thorsten1867
Bugfix

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Mon Jun 20, 2022 12:53 pm
by tatanas
Thank you.

I found a weird one :
The imagebutton tooltip follow the cursor when a spacer is inserted before the imagebutton. All following ImageButton tooltip get the bug.


You can test it in your example by replacing the "Cut" button by a spacer

Code: Select all

ToolBar::Spacer(#ToolBar)
;ToolBar::ImageButton(#ToolBar, #IMG_Cut,   #TB_Cut,   "Cut",   "cutID")

Question : Is it possible to disable the entire toolbar and all the gadgets inside (to grey all of them) ?

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Mon Jun 20, 2022 2:28 pm
by Thorsten1867
Try it again!

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Mon Jun 20, 2022 3:25 pm
by tatanas
Sorry, i've got the same problem. And I suspect it generates a event triggering problem with the ImageButton too with 2 spacers.

In your example (with or without ToolBar::SetPostEvent(#ToolBar, #PB_Event_Menu)) :

Code: Select all

    ;ToolBar::ImageButton(#ToolBar, #IMG_New,   #TB_New,   "New",   "newID") 
    ToolBar::TextButton(#ToolBar, "New", #TB_New, "newID") 
    ToolBar::ImageButton(#ToolBar, #IMG_Save,  #TB_Save,  "Save",  "saveID")
;     ToolBar::Separator(#ToolBar)
ToolBar::Spacer(#ToolBar)
    ToolBar::ImageButton(#ToolBar, #IMG_Copy,  #TB_Copy,  "Copy",  "copyID")
;     ToolBar::ImageButton(#ToolBar, #IMG_Cut,   #TB_Cut,   "Cut",   "cutID")
ToolBar::Spacer(#ToolBar)
    ToolBar::ImageButton(#ToolBar, #IMG_Paste, #TB_Paste, "Paste", "pasteID")

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Mon Jun 20, 2022 6:52 pm
by Thorsten1867
Can't understand the problem. Both examples seem to work for me.

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Tue Jun 21, 2022 7:59 am
by tatanas
Weird...
I'm using PB 5.73 64bits on win10.

I can see in _MouseMoveHandler() that the ImageButtons before the spacer are drawn only once when the mouse is hovering them (and stand on it).
But the ImageButtons after the spacer are redrawn continuously. It is passing in the "Default" case at each iteration.

EDIT : I added a "Case #Spacer" in _MouseMoveHandler() and it seems to work correctly now.

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Tue Jun 21, 2022 9:19 am
by tatanas
Concerning the button event not triggered, it seems the ImageButton next to the spacer got a wrong "Type".
I can see it in _LeftButtonDownHandler() because it got the #spacer value "6" instead of "1" (#imagebutton).
Could it be a problem with the "If X > TBEx()\Items()\X And X < TBEx()\Items()\X + TBEx()\Items()\Width" and "If Y > ..." test ? The position of the ImageButtons seems wrong because of the spacers (even if they are well displayed).

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Tue Jun 21, 2022 11:35 am
by Thorsten1867
Update:
  • Bugfixes
  • DPI-Handling
  • MouseEvents reworked

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Tue Jun 21, 2022 12:18 pm
by tatanas
Sorry. Same test as before, bug's still present (modified example below) :

Code: Select all

   ToolBar::TextButton(#ToolBar, "New", #TB_New, "newID") 
    ToolBar::ImageButton(#ToolBar, #IMG_Save,  #TB_Save,  "Save",  "saveID")
ToolBar::Spacer(#ToolBar)
;     ToolBar::Separator(#ToolBar)
    ToolBar::ImageButton(#ToolBar, #IMG_Copy,  #TB_Copy,  "Copy",  "copyID")
ToolBar::Spacer(#ToolBar)
;     ToolBar::ImageButton(#ToolBar, #IMG_Cut,   #TB_Cut,   "Cut",   "cutID")
    ToolBar::ImageButton(#ToolBar, #IMG_Paste, #TB_Paste, "Paste", "pasteID")
    ToolBar::Separator(#ToolBar)
    CompilerIf ToolBar::#EnableToolBarGadgets
The Paste Button is only triggered when the mouse Y is between 40 and 43.

The tooltip is following the mouse on every ImageButton (on your unmodified example).


EDIT : I think I got it. The position of the spacer is overlapping the position of the button, so it break the loop inside _LeftButtonDownHandler() before processing the button. (in black, the draws of the spacers)
Image

EDIT 2 : Adding

Code: Select all

If TBEx()\Items()\Type = #Spacer : Continue  : EndIf
inside _LeftButtonUpHandler() and _LeftButtonDownHandler() seems to fix the problem

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Tue Jun 21, 2022 1:14 pm
by Thorsten1867
The problem with overlapping should now be solved. Does this also solve your problem?

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Posted: Tue Jun 21, 2022 1:49 pm
by tatanas
It seems Ok.
Thank you very much !


I added a DisableToolBar() procedure too :

Code: Select all

  	Procedure   DisableToolBar(GNum.i, State.i)	
		If FindMapElement(TBEx(), Str(GNum))
			ForEach TBEx()\Items()
				If State
					TBEx()\Items()\Flags | #Disable
				Else
					TBEx()\Items()\Flags & ~#Disable
				EndIf
			Next
			If TBEx()\ReDraw : Draw_() : EndIf	
		EndIf
	EndProcedure