X# App as owner to a WPF Dialog

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

X# App as owner to a WPF Dialog

Post by rjpajaron »

Hello,

I tried, but it seems not to work with compiler.

Code: Select all

	LOCAL owpf AS WPFDialog
		
	owpf := WPFDialog{}

	owpf:Owner := GetAppObject():Handle()
    
	oselect:ShowDialog()
I can let WPF dialog as modeless and operates another app in Windows 10 with ALT+Tab entries. But I really wish to make it modal and owned by the X# app.

--

Rene
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

X# App as owner to a WPF Dialog

Post by FFF »

What is "does not work with the compiler" ? Compile Error, runtime error, not modal...?
You should know better, than post such rudimentary complaint. ;-)
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# App as owner to a WPF Dialog

Post by wriedmann »

Hi Rene,
I don't think you can make a WPF dialog modal to a VO GUI classes application - the message loops are too different.
I think you will have to use the Windows Forms compatibility classes and put the WPF dialog into a WIndows Forms dialog.
That has nothing to do with any compiler issues - it is a question of the different GUI classes architecture.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

X# App as owner to a WPF Dialog

Post by ic2 »

Hello Rene,

I wonder how you created the WPF window?

If you create a WPF type X# project from (e.g.) Visual Studio you will get (default) a MainWindow.xaml with a MainWindow.xaml.prg. The first one is the window, the second one is the code behind and will show:

InitializeComponent()

This is enough to start your WPF window.

Then it should be possible to open that window model elsewhere too with the code you use. I open a WPF window (with C# code behind) from an X# DLL (which I call from a VO program) almost the same way as you do. That's why I wondered if you created the WPF window correctly - does it run in the way I describe? Then it should also open with the code you use, from elsewhere in the program.

As Wolfgang wrote, not sure if you can mix VO GUI style windows with WPF, although that is basically what I do (from VO).

Dick
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

X# App as owner to a WPF Dialog

Post by rjpajaron »

THANKS WOLFGANG.

I have limited internet connection yesterday but I already figure out what to do today. My internet is back to normal. I have WPF dialog now running and I made it modal in other way around.

The compiler error is revealing: "Cannot implicitly convert type 'PTR' to 'System.Windows.Controls.ContentControl'

I am now treating X# Apps (legacy VO) as Win32. Lots of codes in SO. Seems to be working.

First: I do not want my users to get lost of the dialog when they do ALT+Tab. I want the WPF dialog to on top of the calling X# VO apps. I am now updating the WPF dialog to have a Taskbar entry. etc.... seems to be working great.

FYI: I am seldom posting problems here. Last week, X# is very helpful on resolving issues on Macrocompiler. It took awhile as I have so many to do in a very tight schedule. Thanks to those who can help but NO THANKS TO THOSE WHO ADD MORE TO MY STRESS.

Thanks for additional info Wolfgang.
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

X# App as owner to a WPF Dialog

Post by rjpajaron »

Maybe I have to offline X# forums for now. Thanks X# Team.
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

X# App as owner to a WPF Dialog

Post by ic2 »

Hello Rene,
rjpajaron wrote:THANKS WOLFGANG.
Thanks to those who can help but NO THANKS TO THOSE WHO ADD MORE TO MY STRESS.
I've been following your posts (like I do with most posts) and I wonder who is adding to your stress?

My impression is that everyone who has taken the time and effort to reply on your posts is trying to help and not trying to add to your stress.

When I post something it often happens that one reply is useful, another not (in my situation at least) and also some replies are criticizing what I did, or ask. But I am grateful for every reply. Also when a reply is that I am plain wrong it could be a useful reply after all. And in this thread I am the only other one who replied and I was really wondering if my reply, trying to help you how find out if your WPF window at least works, is the reply which added to your stress??

Dick
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

X# App as owner to a WPF Dialog

Post by FFF »

Hi Dick,
i suppose, this was aimed at myself, as i noticed, that his problem description to be somewhat wanting ;)
Well, i think, it was... Hopefully he will solve the pressing issues.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

X# App as owner to a WPF Dialog

Post by ic2 »

Hello Karl,
FFF wrote:i suppose, this was aimed at myself, as i noticed, that his problem description to be somewhat wanting ;)Well, i think, it was... Hopefully he will solve the pressing issues.
I didn't even count your remark as potentially unhelpfull. After all it was a valid question which is probably often the first one you ask your customers too :)
Dick
Post Reply