Click here to Skip to main content
15,913,486 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: TQOTM Pin
Tim Carmichael11-Mar-17 4:29
Tim Carmichael11-Mar-17 4:29 
GeneralRe: TQOTM Pin
Tim Deveaux11-Mar-17 7:11
Tim Deveaux11-Mar-17 7:11 
GeneralRe: TQOTM Pin
Tim Carmichael11-Mar-17 7:53
Tim Carmichael11-Mar-17 7:53 
GeneralRe: TQOTM Pin
Tim Deveaux11-Mar-17 7:57
Tim Deveaux11-Mar-17 7:57 
GeneralRe: TQOTM Pin
Tim Carmichael11-Mar-17 8:38
Tim Carmichael11-Mar-17 8:38 
GeneralRe: TQOTM Pin
Tim Deveaux11-Mar-17 8:52
Tim Deveaux11-Mar-17 8:52 
GeneralRe: TQOTM Pin
Mark_Wallace11-Mar-17 23:59
Mark_Wallace11-Mar-17 23:59 
GeneralGimme codez, urgentz! Pin
CDP180210-Mar-17 22:56
CDP180210-Mar-17 22:56 
Not really, it's more like the other way around. Whatever caused the problem quietly went away and just worked like a charm when I wanted to take another look at it. Perhaps I have frienly Kobolds or Elves in my house that secretly fixed it overnight.

I was working on the sample program to demonstrate my UI again. This time I'm grimly determined to write an article about it. I'm a little proud of that particular bit of code and I think it may be far enough to be of use to other people.

This is the XAML for a small view (as in Model View Presenter). Since the 3D engine is not running in the background, this view just fills the background with an image and a button to end the program that comes useful when the program runs in fullscreen mode:

<BackgroundView Id="BackgroundView" Width="1024" Height="768" DockStyle="ADAPT"
                xmlns="clr-namespace:FoC.PraetorUIDemo.Presentation.Views;assembly=PraetorUIDemo"
			    xmlns:fw="clr-namespace:Microsoft.Xna.Framework;assembly=MonoGame.Framework"             
                xmlns:foc="clr-namespace:FoC.Praetor4UI.Controls;assembly=Praetor4UI" 
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <foc:cPraeImage Id="ImgBackground" PositionX="0" PositionY="0" Width="1024" Height="768" Alpha="255" ImagePosition="SCALE" Image="Background" >
    	<foc:cPraeImageButton Id="BtnTerminate" Image="Button_96" PositionX="918" PositionY="10" Width="96" Height="20" Text="Exit" LeftButtonClicked="BtnTerminateProgram_LeftButtonClicked"/>
    </foc:cPraeImage>
</BackgroundView>

The click event of the button should be wired up to its event handler like this:

LeftButtonClicked="BtnTerminateProgram_LeftButtonClicked"

This never worked up to now. Since I don't enjoy the comfort of a designer that generates things like that in a partial class, I had to write code like this for every control:

public override void Initialize()
{
    m_BtnTerminateProgram = Controls.GetComponent("BtnTerminate") as cPraeImageButton;
    if (m_BtnTerminateProgram != null)
    {
        m_BtnTerminateProgram.LeftButtonClicked += new
                PraeMouseButtonEvent(BtnTerminateProgram_LeftButtonClicked);
    }
}

This worked, but for larger views with many controls this meant to write a awkwardly long method. Not anymore! Wiring up the button from XAML now works without any additional code in the Initialize() method.

Thanks, Elves!
The language is JavaScript. that of Mordor, which I will not utter here

This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.

"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."

If software development were a circus, we would all be the clowns.


modified 11-Mar-17 5:41am.

GeneralRe: Gimme codez, urgentz! Pin
Slacker00711-Mar-17 0:32
professionalSlacker00711-Mar-17 0:32 
GeneralRe: Gimme codez, urgentz! Pin
OriginalGriff11-Mar-17 1:17
mveOriginalGriff11-Mar-17 1:17 
GeneralRe: Gimme codez, urgentz! Pin
Slacker00711-Mar-17 1:19
professionalSlacker00711-Mar-17 1:19 
GeneralRe: Gimme codez, urgentz! Pin
CDP180211-Mar-17 2:17
CDP180211-Mar-17 2:17 
GeneralRe: Gimme codez, urgentz! Pin
CDP180211-Mar-17 1:47
CDP180211-Mar-17 1:47 
JokeRe: Gimme codez, urgentz! Pin
User 1106097911-Mar-17 4:44
User 1106097911-Mar-17 4:44 
GeneralRe: Gimme codez, urgentz! Pin
CDP180211-Mar-17 5:17
CDP180211-Mar-17 5:17 
GeneralRe: Gimme codez, urgentz! Pin
User 1106097911-Mar-17 5:18
User 1106097911-Mar-17 5:18 
GeneralRe: Gimme codez, urgentz! Pin
Ravi Bhavnani11-Mar-17 5:00
professionalRavi Bhavnani11-Mar-17 5:00 
GeneralRe: Gimme codez, urgentz! Pin
Slacker00711-Mar-17 11:03
professionalSlacker00711-Mar-17 11:03 
GeneralRe: Gimme codez, urgentz! Pin
Ravi Bhavnani11-Mar-17 11:06
professionalRavi Bhavnani11-Mar-17 11:06 
GeneralThere are more of 'em than I suspected... Pin
OriginalGriff10-Mar-17 22:32
mveOriginalGriff10-Mar-17 22:32 
GeneralRe: There are more of 'em than I suspected... Pin
CDP180210-Mar-17 23:07
CDP180210-Mar-17 23:07 
GeneralRe: There are more of 'em than I suspected... Pin
Johnny J.11-Mar-17 0:01
professionalJohnny J.11-Mar-17 0:01 
GeneralRe: There are more of 'em than I suspected... Pin
OriginalGriff11-Mar-17 0:32
mveOriginalGriff11-Mar-17 0:32 
GeneralRe: There are more of 'em than I suspected... Pin
Duncan Edwards Jones11-Mar-17 5:07
professionalDuncan Edwards Jones11-Mar-17 5:07 
GeneralRe: There are more of 'em than I suspected... Pin
Roger Wright11-Mar-17 16:41
professionalRoger Wright11-Mar-17 16:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.