Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
cadbusca
5 discussion posts
I love the idea of accessing several Functions as TitleBar Buttons, but sometimes it can pollute a little bit the Title Bar.
So the idea would be to create a "Special TitleBar Button" that once clicked would display a menu with others TitleBar Buttons so it would be possible to access several Functions and have only one TitleBar Button in the Title Bar.

This could be done (for example) by adding some controls to the Functions Tab:
* Adding an Enable/Disable check box to the "Special TitleBar Button"
* Creating a new Toggle "Special TitleBar Button" for the selected Function
Sep 16, 2015  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
This is currently on our feature request list, so I've added your vote to it. We'll be sure to let you know if/when we're able to implement it in the future.

Thanks!
Sep 16, 2015  • #2
User Image
Jcee
205 discussion posts
Perhaps this will meet your needs. You may want to modify it though :P

Code

using System;
using System.Drawing;
using System.Windows.Forms;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Window Location target when run by a Window Location rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
//these are all of the functions from the "Window Management" functions list
//the function are just called by their names. to find their names, you can copy them
//from the context menus, or type "BFS.DisplayFusion.RunFunction(" and a window will come up
//with all of the available functions
//"--- Abbrechen ---" is german for "cancel". Used to cancel the action, see below "MenuItem_Click"
BFS.DisplayFusion.RunFunction("Prevent Window Deactivation (keeps game windows focused)");

string[, ,] MenuEntries = 
{
//{{ "Background-Color", "Foreground-Color", "Function-Name" }}

{{ "WhiteSmoke", "Black", "Move Window to Next Monitor" }},
{{ "White", "Black", "Span Window Across all Monitors" }},
{{ "WhiteSmoke", "Black", "Minimize Window To System Tray" }},
{{ "White", "Black", "Minimize All Windows Except Current Window (All Monitors)" }},
{{ "WhiteSmoke", "Black", "Toggle Window Always on Top" }},
{{ "White", "Black", "Lock/Unlock Mouse Cursor to Current Focused Window" }},
{{ "WhiteSmoke", "Black", "Full-Screen(Windowed)" }},

{{ "White", "Black", "Prevent Window Deactivation (keeps game windows focused)" }},
{{ "WhiteSmoke", "Black", "Load Next Monitor Profile (alphabetically)" }},
{{ "White", "Black", "Game Mode" }}

};

//create a new ContextMenuStrip to show the items
using(ContextMenuStrip menu = new ContextMenuStrip())
{
//dont show the padding on the left of the menu
menu.ShowCheckMargin = false;
menu.ShowImageMargin = false;

//add items to the menu, and use our custom function when a user clicks on the items
for ( int i = 0; i < ( MenuEntries.Length / MenuEntries.Rank ); i++ )
{
menu.Items.Add(MenuEntries[i, 0, 2]);
menu.Items[menu.Items.Count - 1].Click += MenuItem_Click;
menu.Items[menu.Items.Count - 1].BackColor = Color.FromName( MenuEntries[i, 0, 0]);
menu.Items[menu.Items.Count - 1].ForeColor = Color.FromName( MenuEntries[i, 0, 1]);
}

//if the menu will show on the screen, show it. otherwise, show it above the mouse
if(BFS.Monitor.GetMonitorBoundsByMouseCursor().Contains(new Point(BFS.Input.GetMousePositionX(), BFS.Input.GetMousePositionY() + menu.Height)))
menu.Show(BFS.Input.GetMousePositionX(), BFS.Input.GetMousePositionY());
else
menu.Show(new Point(BFS.Input.GetMousePositionX(), BFS.Input.GetMousePositionY()), ToolStripDropDownDirection.AboveRight);

//set focus to the menu
BFS.Window.Focus(menu.Handle);

//wait for the menu to close
while(menu.Visible)
Application.DoEvents();

BFS.DisplayFusion.RunFunction("Prevent Window Deactivation (keeps game windows focused)");
}
}

//this function will get the text of the item and try to run it as a DisplayFusion function
//"--- Abbrechen ---" (Cancel), change it to what you used in MenuEntries-List
private static void MenuItem_Click(object sender, EventArgs e)
{
ToolStripItem item = sender as ToolStripItem;
if (item == null || item.Text == "--- Abbrechen ---")
return;

BFS.DisplayFusion.RunFunction(item.Text);
}
}


Go to the functions tab, click add scripted, paste this in, hit OK, and assign it a title-bar button
Sep 17, 2015  • #3
User Image
cadbusca
5 discussion posts
Jcee, this code does meet my needs.
Thank you very much for sharing it with me and the community!!
Sep 17, 2015 (modified Sep 18, 2015)  • #4
User Image
Jcee
205 discussion posts
Yup :P Actually keith coded it for me a while back (though I've done some customization's and fixes to it). Suprised it hasnt been added to the custom functions list, Its currently my most used function :P
Sep 17, 2015  • #5
User Image
cadbusca
5 discussion posts
Jcee and Keith, when I click on the TitleBar Button for this scripted function a "sword like" song is played and also after selecting an item a sound can be heard. Is there a way to turn them off?

Update:
I removed the 2 lines containing:
BFS.DisplayFusion.RunFunction("Prevent Window Deactivation (keeps game windows focused)");
and the sound is gone.

Thanks.
Sep 18, 2015 (modified Sep 18, 2015)  • #6
User Image
Jcee
205 discussion posts
That would remove it yes, but it *may* cause other issues (like the window going behind other windows)

The correct way is to click advanced settings at the bottom right of the settings page
and change the setting 'Disable Sound Effects'
(while your there you may want to also change "Dont Show Tray Icon Notification Balloons"
Sep 18, 2015  • #7
User Image
cadbusca
5 discussion posts
Jcee, thank you for warning me about those possible issues.
I´m going to follow your recommendations.
Sep 18, 2015  • #8
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)