Jump to content
The simFlight Network Forums
ark1320

P3Dv4 Display Help Needed

Recommended Posts

Hi Pete,

Many of my Lua scripts make extensive use of the setowndisplay() command and now that this command does not work in P3Dv4 as it previously did,  I am trying to find alternatives to the extent possible.

As a first step I'm trying to understand how the ipc.setdisplay() command works with the 'common use' P3D4 simconnect message display window. When I run the small test script below with a keystroke, the display window is not in the location or the size that I expect.  I understand ipc.setdisplay parameters are percentages relative to a display window, but what window?  Do the percentages apply to the previous window even after it has been closed? Do I perhaps need to somehow reset the P3D4 simconnect display window location and size (e.g., to 'full screen size') before setting it to the size I need?   Clearly there is something basic I don't understand about initializing and controlling the common simconnect message window location and size.

In addition, when I ran the script below I got the 'dual' display (green bar and the little simconnect msg window) shown below as expected. But if I comment out the ipc.writeSTR() and ipc.writeSW() lines, I get no display at all.  It is as if the green bar string display is also triggering the simconnect msg window display somehow. Without that trigger there is no simconnect window display.  Also note the ipc.getdisplay() returns a sy window size of 50 vs 60 for some reason. If I change the simconnect location parameters from 100, 100 to 50, 50, the little display window moves about an inch to the left and an inch up on the screen.

Test script:

ipc.setdisplay (100, 100, 40, 60)
ipc.display ("TEST")
state, x,y, sx, sy = ipc.getdisplay()
ipc.writeSTR(0x3380, state..x..y..sx..sy)           
ipc.writeSW(0x32FA, 10)
ipc.sleep (10000)
ipc.display ("")         

return

               

  5a6e4cfc66.JPG

Thanks for your help,

Al
FSUIPC 5.14
Win10, P3Dv4.3

Edited with new information

Share this post


Link to post
Share on other sites

Pete,

Another problem related to the issue of display in P3Dv4 as described above:

After reinstalling P3Dv4 and FSUIPC5 (after a Win10 update caused problems), I not getting any Lua script displays at all on the screen (not the green bar or the simconnect message window) even though the Lua scripts are running . For example, I have a script that moves an aircraft after asking the user to input information like new heading, distance to move, etc, using the ipc.ask() function.  Even though there is no display as expected as a result of the ipc.ask() functions, the aircraft does move as expected based on the inputs I provide "in the blind". And these scripts have all been used in FSX for a long time. I had the exact same problem the first time I installed P3Dv4 and FSUIPC5 and after a day of struggles the problem went away but I don't know why ( have not been so lucky this time). The issue seems to have to do with somehow initializing the simconnect message window  location and size in order to get a display on the screen.

Al

Share this post


Link to post
Share on other sites
4 minutes ago, ark1320 said:

The issue seems to have to do with somehow initializing the simconnect message window  location and size in order to get a display on the screen.

I am currently investigating a problem whereby trying to set the display size and position more than once appears sometimes to stop the display actually appearing. i think this is a bug in P3D4, because all the correct calls are still being made to SimConnect. What seems to work reasonably consistently is using setdisplay only AFTER displaying something. But even then it appears to be precarious.

I am trying to find a work-around at this moment. No luck so far after several hours of trials.

On your previous points:

1. I will be removing "setowndisplay" completely in FSUIPC5 until I can find a way of doing it in P3D4

2. The coordinates and sizes in setdisplay are in SCREEN coordinates, and the top left position specified is relative to the main P3D window. This has always been the case. Only the setowndisplay was in percentages of that window.

3. I think this next part is the same problem as the first paragraph above. It's to do with repeated use of the setdisplay function in the same session.

On 8/16/2018 at 6:21 PM, ark1320 said:

But if I comment out the ipc.writeSTR() and ipc.writeSW() lines, I get no display at all.  It is as if the green bar string display is also triggering the simconnect msg window display somehow. Without that trigger there is no simconnect window display.

You might find that it works more consistently if you do the setdisplay AFTER the display.

I don't think it is related to the simple one-line text display.

14 minutes ago, ark1320 said:

The issue seems to have to do with somehow initializing the simconnect message window  location and size in order to get a display on the screen.

It is certainly due to the attempts to size and move the Window -- something done via Windows itself, not via Simconnect as the latter provides no such facilities (and shouldn't really need to). P3D4 seems to use some method of hiding the wndow which contrives to stay hidden one the change is made via Windows. I'm trying to track that down.

BUT you don't NEED to position and size the Window. I'd recommend commenting out those attempts until I can sort it out, if indeed that is possible without L-M's cooperation.

Pete

 

 

Share this post


Link to post
Share on other sites

Pete,

In regard to my second post above about NO display after reinstalling P3Dv4, the solution to the problem was I needed to check the Message Text box found on the P3Dv4 Information Tab under MISCELLANEOUS TEXT.   That little detail has cost me many many hours of grief, so I hope this helps someone!

Regarding my first post above, I have found the best temporary solution is to grab and reposition/resize the SimConnect Msg window as I want it and leave it there for all Lua scripts to use. I have temporarily commented out all the ipc.setdisplay() commands from the scripts. This is not an ideal solution, but better than what I had. And if you ever find a way to have more than one window active at a time, that would be great!  I really miss having that capability.

Thanks very much for your efforts with this difficult display issue.

Al

Share this post


Link to post
Share on other sites
1 minute ago, ark1320 said:

In regard to my second post above about NO display after reinstalling P3Dv4, the problem was I needed to check the Message Text box found on the P3Dv4 Information Tab under MISCELLANEOUS TEXT.

Ah ... but surely that, like all of those, if checked by default? I've never seen any of those options unchecked (I uncheck them all myself in my cockpit installation, because I have the test and message windows tranmitted via WideFS to a little screen in-cockpit).

4 minutes ago, ark1320 said:

I have found the best temporary solution is to grab and reposition/resize the SimConnect Msg window as I want it and leave it there for all Lua scripts to use.

FSUIPC should save the sizes and positions for you and restore them next session.  You have to change "RestoreSimcWindows=No" to Yes in the [General] section of the INI file.

3 minutes ago, ark1320 said:

This is not an ideal solution, but better than what I had.

I've made progress since my last message, but I don't think it is foolproof. doing more checks now ...

7 minutes ago, ark1320 said:

And if you ever find a way to have more than one window active at a time, that would be great!  I really miss having that capability.

I agree. I used to use it a lot when I was developing my cockpit software.

Pete

 

Share this post


Link to post
Share on other sites
5 minutes ago, Pete Dowson said:

FSUIPC should save the sizes and positions for you and restore them next session.  You have to change "RestoreSimcWindows=No" to Yes in the [General] section of the INI file.

Ah, a great tip -- thanks!

Al

Share this post


Link to post
Share on other sites

Further to my last message, I think a work-around i eventually hit upon is working well. Would you like to test it further for me? I can make an interim build (replacement DLL only) for Monday.

I am also thinking of having an option so that:

ipc.setdisplay(SET_PROP, x, y, cx, cy)

(say -- not sure of what name to give the option selection. PROP is ambiguous. PERCENT perhaps?)

which would enable the Window still to be set in relative proportional coordinates the same as setowndisplay used to. If I do that I can resurrect setowndisplay so it acts like setdisplay except of course for the "own" part, until (or if) I manage to find a way ...

Pete

 

Share this post


Link to post
Share on other sites
7 minutes ago, Pete Dowson said:

Further to my last message, I think a work-around i eventually hit upon is working well. Would you like to test it further for me? I can make an interim build (replacement DLL only) for Monday.

Sure, glad to help. I can just uncomment the ipc.setdisplay() commands in my scripts to test things.

9 minutes ago, Pete Dowson said:

(say -- not sure of what name to give the option selection. PROP is ambiguous. PERCENT perhaps?)

Maybe ipc.setdisplay(SET_PERCENTS: x, y, cx, cy)     The : after PERCENTS implies the x,y,cx,cy parameters are percentages, at least to me.  😊

BTW, the RestoreSimcWindows=Yes option does not seem to work for me -- another P3Dv4 casualty I guess.

Al

Share this post


Link to post
Share on other sites
1 hour ago, ark1320 said:

Maybe ipc.setdisplay(SET_PERCENTS: x, y, cx, cy)     The : after PERCENTS implies the x,y,cx,cy parameters are percentages, at least to me.

I think I'll use SET_PCTS and SET_SCRN, with the latter defaulted if omitted for compatibility.

setowndisplay will use SET_PCTS automatically, and, for now, discard the title.

1 hour ago, ark1320 said:

BTW, the RestoreSimcWindows=Yes option does not seem to work for me -- another P3Dv4 casualty I guess.

Ah. Ah you full screen? If not it automatically disables in any case. I should have mentioned that. When i first implemented it, it wasn't optional and tried to work no matter what. But when folks changed between full screen and windowed it all got into a mess for them. There was really no way of making it work cleanly with a Window which can be anywhere. 

The sizes and positions are saved in the INI file in new sections -- but only once the displays have been used once, because they don't seem to exist till then. in a session, once used once they always exist even if not visible.

If you send me an email (petedowson@btconnect.com) by Monday when a test DLL is ready I'll send a link. (DLL's like EXE's don't pass many checkers these days).

Pete

 

Share this post


Link to post
Share on other sites
7 minutes ago, Pete Dowson said:

Ah. Ah you full screen? If not it automatically disables in any case.

OK, yes, I use the Window mode with P3D4, so that explains why it didn't work. Not really important in the scheme of things right now.

I will send you an email  now so you can respond on Monday at your convenience.

Thanks,

Al

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.