Hi,
I'm having to apply vScroll and HScroll bars to a window on some big windows that we have which wouldn't fit an smaller screen resolutions. If the WorkSpaceHeight() is smaller than a certain values, I want to set the width and height of the window to it's 'original' value and show scrollbars.
As an example, I'm setting the width and height in the 'other' tabpage to 4000 and 2000.
The problem I'm having is obtaining the 'original' value from code:
Exported code PB 6.5:
global type w_genapp_sheet from Window
int X=672
int Y=264
int Width=4000
int Height=2000
boolean TitleBar=true
string Title="Sheet"
When running, the only difference I seem to get is in the height: a bit less, probably caused by the windows title occupying some space.
Exported code PB 12.6, PB 2017, PB2019:
global type w_genapp3_sheet1 from w_genapp3_basesheet
string tag = "Untitled for Sheet 1"
integer width = 4037
integer height = 2180
Then when I run the application, I'm getting these values:
Width 7333 and height 2548, pretty different from the specified values of 4000x2000.
If I set my 'windows scaling' to 125% I'm getting these values:
Is there any explanation for this? What I'm I missing?
Do I have to convert units to pixels and vice versa or something?
TIA
there is a difference between "original" width and height values and the correct window size because of different window settings. I found out that options border, resizeable, clientedge, titlebar, palettewindow, scrollbars and menu makes the difference.
Here my code:
li_vars = UpperBound ( lcd_class.VariableList )
For li_v = 1 to li_vars
If lcd_class.VariableList[li_v].Name = "width" Then li_origwidth = Integer ( lcd_class.VariableList[li_v].InitialValue )
If lcd_class.VariableList[li_v].Name = "height" Then li_origheight = Integer ( lcd_class.VariableList[li_v].InitialValue )
If li_origwidth > 0 And li_origheight > 0 Then Exit
Next
IF this.Border THEN
li_origheight -= 8
li_origwidth -= 10
END IF
IF this.Resizable THEN
li_origheight -= 24
li_origwidth -= 27
END IF
IF this.Clientedge THEN
li_origheight -= 16
li_origwidth -= 21
END IF
IF this.Titlebar THEN
IF this.PaletteWindow THEN
li_origheight -= 12
ELSE
li_origheight -= 72
END IF
END IF
IF this.HScrollbar THEN
li_origheight -= 73
END IF
IF this.VScrollbar THEN
li_origwidth -= 64
END IF
IF IsValid (this.MenuId) THEN
li_origheight -= 76
END IF
Very useful!