Dialog size behaviour: VO dialog appears narrower (only width!) in X#

This forum is meant for questions and discussions about the X# language and tools
User avatar
Chris
Posts: 4898
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by Chris »

Hi Stefan,

Indeed, it should show identical in VO and X#. Can you please create and post a small (compilable) sample demonstrating this different behavior so we can test with it?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by leon-ts »

Stefan,
Perhaps there is an influence from the .NET framework itself. There are known features that result in slight visual differences when displaying Win32 windows from native Win32 applications (like VO) and from a .NET application.
More info here:
https://stackoverflow.com/questions/147 ... -5-net-4-0
Best regards,
Leonid
stefan.ungemach
Posts: 71
Joined: Thu Jul 15, 2021 10:46 am
Location: Germany

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by stefan.ungemach »

Hi Chris,

here is a simple example. The following code is exactly the same in VO and XSharp:
FUNCTION DialogWindowTest AS VOID
    LOCAL oDlg AS MyDialogWindow
    LOCAL oOwner AS OBJECT
    
    oOwner := GetObjectByHandle(GetActiveWindow())
    DO WHILE IsAccess( oOwner, #Owner )
        oOwner := oOwner:Owner
    ENDDO
    oDlg := MyDialogWindow{}    
    oDlg:Size := dimension{ 300, 300 }
    oDlg:Show( SHOWCENTERED )
    RETURN
    
    
CLASS MyDialogWindow INHERIT myDialogWindow_vo
    
    METHOD _Setup() AS VOID
        
        
        LOCAL oPsh AS pushButton
        LOCAL nX := 10 AS INT
        LOCAL nW := 200 AS INT
        
        oPsh := pushButton{ SELF, -1, point{nX,150}, dimension{ nW,20 },"OK" }
        oPsh:Show()
        
        SELF:Size := dimension{ nX + oPsh:size:width + nX , SELF:Size:height }
        SELF:Caption := "myDialogWindow XSharp "+ntrim(SELF:size:width)+" x "+ntrim(SELF:size:height)
        
        RETURN
        
        
    METHOD Show( kMode )
        
        
        SELF:_Setup()
        
        SUPER:Show( kMode )
        RETURN SELF
        
        
END CLASS    
MyDialogWindow_vo is a newly created DIALOGWINDOW via the window entity editors in VO/X# (all defaults, no modifications). The call of DialogWindowTest on the same machine, same resolution, same time, produces different windows (the X# version resulting a bit too narrow for the control):

​​​​​​​ 
DialogCompare.png
DialogCompare.png (10.42 KiB) Viewed 863 times
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by ecos »

Hi Stefan,

try
/subsystemversion:5.00
in "extra command line options"
(Eigenschaften / Build)

Karl
stefan.ungemach
Posts: 71
Joined: Thu Jul 15, 2021 10:46 am
Location: Germany

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by stefan.ungemach »

Hi Karl,

perfect: that does the trick!

 
DialogX#4.png
DialogX#4.png (7.63 KiB) Viewed 863 times
Now the behaviour is 1:1 to VO. But what kind of magic is this?
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by ecos »

I have this "kind of magic" from Robert. He should be able to explain it.
It also suppresses these ugly thick frames around datawindows...
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by wriedmann »

Hi Karl,
with "ugly thick frames around datawindows" do you mean these XP style frames?
Screenshot 2023-07-19 160502.png
Screenshot 2023-07-19 160502.png (6.98 KiB) Viewed 863 times
They are present also in VO applications, unfortunately.
Using XIDE this does do not seem to change anything....
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by leon-ts »

Hello Wolfgang,
I also worried about this issue. But judging by this thread, it's a problem in Windows itself (except Windows Server 2012) and it still hasn't been fixed:
https://github.com/dotnet/winforms/issues/3691
And something tells me that, unfortunately, will never be fixed.
Best regards,
Leonid
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by ecos »

Hi Wolfgang,

screenshot 1 without /subsystemversion, screenshot 2 with smaller frames...

 
Screenshot1.png
Screenshot1.png (40.07 KiB) Viewed 863 times
 
Screenshot2.png
Screenshot2.png (44.5 KiB) Viewed 863 times
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Dialog size behaviour: VO dialog appears narrower (only width!) in X#

Post by ecos »

in VO the datawindows looked like screenshot 2. These "ugly, thick frames" indeed also use space of the canvasarea, so controls don't fit as they did in VO.
IMHO this compiler-switch should be used by default in order to be compatible with VO...
Post Reply