JoeViking245 Posted January 18, 2023 Share Posted January 18, 2023 I wanted a way to have a clickable link in LaunchBox to the Internet Pinball Database (IPDB) for each of my Visual Pinball tables. (i.e. https://www.ipdb.org/machine.cgi?id=760 “Eight Ball”). I had thought about putting the links in the Wiki or YouTube fields, but it was kind of ugly. Messing around, I found a way that allowed me to right-click a Custom Field and select "Go to webpage". It opens the default internet browser to whatever hyperlink page is in the Custom Field. Note: this will only work with LaunchBox Premium as the free version doesn't show Custom Fields. For my VPX platform, I also added a custom field for "Table" that would hold a link to the tables’ webpage. (to look for updates or whatever reason) Obviously, you can name the Custom Field anything you want for any circumstance. For any platform. The only pain is entering the hyperlink(s) for each table (or game) individually. (Pict of Right-Clicking the IPDB link.) To make this work, I needed to modify the GameDetailsView.xaml located in the Views folder of the LaunchBox theme. Here’s what I did. Summary: Insert 2 lines of code Comment out 1 line of existing code Insert 1 code block I'll use @faeran's "Default Plus" theme as an example. First, create a copy of the theme’s main folder and then open the GameDetailsView.xaml file (in the copied folder) in Notepad++. (Any text editor will work. I used Notepad++ to make it easy to reference line numbers) D:\LaunchBox\LBThemes\Default Plus - Copy\Views\GameDetailsView.xaml Below the last "xmlns" entry (line 10) insert a new line. (here, we're adding a new reference and calling it "web") xmlns:web="clr-namespace:Unbroken.LaunchBox.Windows.Desktop.Commands;assembly=LaunchBox" Just before the closing of "UserControl.Resources" (line 34 [after inserting the above]), inset a new line. <web:WebLinkCommand x:Key="WebCommand" /> (Here we're creating a static resource which we're calling "WebCommand".) Indents don't matter. But it looks prettier. So far, it looks like this: Now search for and go to CustomFields (or scroll to line 1334 [after inserting the above 2 lines]). A few lines down, click once on the 2nd <TextBlock... line. (line 1345) This is the line that contains Text="{Binding Value}" Press Ctrl+K (Notepad++) to comment out that line. (That may only work because of a plugin I installed. Don't recall. Alternately, add <!-- to the beginning of the line, and --> to the end). <!-- <TextBlock Grid.Column="2" Text="{Binding Value}" Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.ForegroundBrush}" TextWrapping="Wrap" TextAlignment="Right" /> --> Below this [now] commented line, insert the following: <TextBlock Grid.Column="2" Text="{Binding Value}" Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.ForegroundBrush}" TextWrapping="Wrap" TextAlignment="Right" > <TextBlock.ContextMenu> <ContextMenu> <MenuItem Command="{StaticResource WebCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TextBlock}, Path=Text}"> <MenuItem.Header> <TextBlock Text="Go to webpage" HorizontalAlignment="Center"/> </MenuItem.Header> </MenuItem> </ContextMenu> </TextBlock.ContextMenu> </TextBlock> Here we're replacing the original TextBlock with a new one that lets us right-click. If you want it to say something other than “Go to webpage” when you right-click, just replace the part in quotes (Text="Go to webpage"). (Line 1351) Here's what the whole CustomFields section will look like Save and close. Tell LB to use this theme. Caveat: If you have a custom field that's not a hyperlink or is an invalid link and you right-click and select "Go...", you'll get a message box telling you it's an invalid URL. So just don’t do that. 2 1 Quote Link to comment Share on other sites More sharing options...
rexryan Posted November 10 Share Posted November 10 Is this still the way to do links or is there an updated way? Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted November 10 Author Share Posted November 10 25 minutes ago, rexryan said: Is this still the way to do links or is there an updated way? I don't know if it's the way to do links. But it is a way. I just tested my old theme in which I had experimented on (a copy of Default Plus), and it still works. Which leads me to believe there's no reason it won't work on others themes as well. 1 Quote Link to comment Share on other sites More sharing options...
rexryan Posted November 11 Share Posted November 11 On 11/10/2024 at 2:14 PM, JoeViking245 said: I don't know if it's the way to do links. But it is a way. I just tested my old theme in which I had experimented on (a copy of Default Plus), and it still works. Which leads me to believe there's no reason it won't work on others themes as well. Worked like a champ..Thanks have you ever tried to get it to work in BB? Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted November 11 Author Share Posted November 11 16 minutes ago, rexryan said: Worked like a champ..Thanks have you ever tried to get it to work in BB? Glad to hear after almost 2 years later someone actually tried this and it working! Never thought to try it in BigBox. TBH, don't think I've ever used a mouse in BB. Keyboard navigation (cab buttons), yeah. Controller, of course. Quote Link to comment Share on other sites More sharing options...
rexryan Posted November 11 Share Posted November 11 Controller option is where im going..If you come up with something would be awesome Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted November 11 Author Share Posted November 11 1 hour ago, rexryan said: Controller option is where im going..If you come up with something would be awesome Yeah, that'd require a plugin to capture the controller input. Then you'd navigate away from BigBox. And then you have to grab your mouse and keyboard to continue navigation in wherever the link sent you. Since you have to grab the mouse anyway, may as well grab it early and right-click the link in BB. (Assuming the mouse right-click capture works in BB.) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.