Adding Button on the window outer frame

BlitzMax Forums/MaxGUI Module/Adding Button on the window outer frame

Hardcoal(Posted 2013) [#1]
I dont know how to call this frame.
but i mean to add a button (if possible under max gui)
on the window system frame where the Red Close button (X) and the
fold button (_). (Top Right side) is it possible?


xlsior(Posted 2013) [#2]
It's possible, in that there's other programs that do it... For the most part they seem to just track the window position, and draw an image on top of it though -- if you move the window, the extra button will often trail behind.

No idea how to do it in MaxGUI, though.


col(Posted 2013) [#3]
Hiya,

That area is technically called the 'title bar' and under the hood it's called the 'non client area'. Its not possible within the standard maxgui.

However, having said that, everything is possible though if you go low level and create it yourself. If you've seen an app with an icon there already, say like on windows there is an option of a '?', and it turns out that it's standard option within the OS then it's relatively easy to add something in. It's a lot more difficult if you want true custom buttons. When going really low level I've found that MaxGUI can actually get in the way because of the inherent nature of MaxGUI subclassing the OS functions, causing you to modify MaxGUI rather than using the proxy gadget method. Not a bad thing as MaxGUI is slowly showing signs of falling behind the times but going low level can be a lot of work.

What type of icons did you want to add? standard OS or custom? I can help with windows.


Hardcoal(Posted 2013) [#4]
Hey..

Well, Im trying to make a simple improved notpad

And I want two buttons (Generaly its not essential to be on the title bar)
If I can also put it on the Menu (where File,View etc.. is) is also good.

One Button is StayOnTop
second Button is Refresh. refresh just loads the text again instead of closing and opening a text file again.

later I might add some tongues(for multi text files)

thats it more or less. nothing fancy.


col(Posted 2013) [#5]

And I want two buttons (Generaly its not essential to be on the title bar)
If I can also put it on the Menu (where File,View etc.. is) is also good.



I may have mis-understood, but you don't mind having the buttons in the same place where the menus would be? If that's correct you can use MaxGUI and easily use the a menu title to act as a button...

Strict

Import maxgui.drivers

Global window:TGadget = CreateWindow("Test",0,0,300,300)
Global StayOnTopButton_Menu:TGadget = CreateMenu("StayOnTop",0,WindowMenu(window))
Global RefreshButton_Menu:tgadget = CreateMenu("Refresh",0,WindowMenu(Window))

UpdateWindowMenu(window)

Repeat
	WaitEvent
	
	Select EventID()
		Case EVENT_WINDOWCLOSE,EVENT_APPTERMINATE
			End
		
		Case EVENT_MENUACTION
			Select EventSource()
				Case StayOnTopButton_Menu
					Notify "StayOnTop pressed"
					
				Case RefreshButton_Menu
					Notify "Refesh pressed"
					
			EndSelect
	EndSelect
Forever



Hardcoal(Posted 2013) [#6]
U got me right col. Ill give it a run as im now writing from phone.


Hardcoal(Posted 2013) [#7]
Ok, Now the problem is how can I make StayOnTop marked as pressed.
Either by making font bold or button pressed or any other idea is welcome.
Also the buttons should be on the right side and not together with the regular menu.


col(Posted 2013) [#8]
Apologies for the delay. A deadline brought forward piled on the workload.

To achieve what you're asking for then you need to go lower level than MaxGUI. As there a variety of ways of achieving different things make a solid decision of where/what type of custom control you want to make and I'll help you put it together.