xsharp.eu • Dialog size behaviour: VO dialog appears narrower (only width!) in X# - Page 3
Page 3 of 4

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

Posted: Tue Jul 18, 2023 4:34 pm
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?

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

Posted: Tue Jul 18, 2023 5:50 pm
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

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

Posted: Wed Jul 19, 2023 12:33 pm
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 873 times

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

Posted: Wed Jul 19, 2023 12:48 pm
by ecos
Hi Stefan,

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

Karl

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

Posted: Wed Jul 19, 2023 1:11 pm
by stefan.ungemach
Hi Karl,

perfect: that does the trick!

 
DialogX#4.png
DialogX#4.png (7.63 KiB) Viewed 873 times
Now the behaviour is 1:1 to VO. But what kind of magic is this?

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

Posted: Wed Jul 19, 2023 1:15 pm
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...

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

Posted: Wed Jul 19, 2023 2:06 pm
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 873 times
They are present also in VO applications, unfortunately.
Using XIDE this does do not seem to change anything....
Wolfgang

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

Posted: Thu Jul 20, 2023 5:51 am
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.

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

Posted: Thu Jul 20, 2023 6:35 am
by ecos
Hi Wolfgang,

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

 
Screenshot1.png
Screenshot1.png (40.07 KiB) Viewed 873 times
 
Screenshot2.png
Screenshot2.png (44.5 KiB) Viewed 873 times

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

Posted: Thu Jul 20, 2023 6:49 am
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...