Post by Roger Cabo on Mar 20, 2024 18:06:33 GMT 1
some questions:
A) Is it possible to display the complete string buffer size?
Anywhere I read that the string Ram is limited to xxx MB?
Dim len% = 268435455 Seems to be max
Dim len% = 268435456 Cause a violation
Dim len% = 268435457 results in StringLen 1
This appears to be a limitation related to how GFA-Basic 32 performs internal counting or variable storage. The maximum size you can define seems to be 268,435,455. This is precisely 2^28 - 1, which is a typical limit for a signed integer in a 32-bit process where the most significant bit is used as a sign bit.
If I attempt to define a length that exceeds this number, an overflow occurs, which in GFA-Basic 32 either leads to an error or resets to an internal representation that appears to be interpreted as 1 and above.
Dim len% = 268435458 results in StringLen 2
B) I have some strange issues with GB32. Sometimes while listing controls like:
Could it be better to set c and f each time prior "For Each * In *.Controls" to f and c = Nothing?
I was able to fix the crash :
Update: There are some really crazy things going on here.
When changing the settings as you can see on the picture, then the error is solved if I save the source code once.
Then it possible to run in 4K and High res as well and all seems to be fine.
But why saving the code once helps?
A) Is it possible to display the complete string buffer size?
Anywhere I read that the string Ram is limited to xxx MB?
$Library "gfawinx"
$Library "UpdateRT"
UpdateRuntime ' Patches GfaWin23.Ocx
Dim len% = 280000000
Dim a$ = Space(len%)
MsgBox Len(a$)
Dim len% = 268435455 Seems to be max
Dim len% = 268435456 Cause a violation
Dim len% = 268435457 results in StringLen 1
This appears to be a limitation related to how GFA-Basic 32 performs internal counting or variable storage. The maximum size you can define seems to be 268,435,455. This is precisely 2^28 - 1, which is a typical limit for a signed integer in a 32-bit process where the most significant bit is used as a sign bit.
If I attempt to define a length that exceeds this number, an overflow occurs, which in GFA-Basic 32 either leads to an error or resets to an internal representation that appears to be interpreted as 1 and above.
Dim len% = 268435458 results in StringLen 2
The simple reason is to change the display properties because of a dynamic count of controls.
I'm running GB32 on a 4K screen:
Function Change_ChildControlPropertys_InsideForm(ByRef frm As Form) As Int
Dim i% = 0, s% = 0, f As Form, c As Control
For Each f In App.Forms
For Each c In f.Controls
If GetParent(c.hWnd) = frm.hWnd
If frm.Name = "TP_Frm5_TerminZeiten"
If TypeOf(c) Is TextBox // Search for all TextBoxes and change appearance
c.borderstyle = 0
c.appearance = 1
c.fontsize = 11
c.height = c.height + 2
EndIf
EndIf
If frm.Name = "frx2"
If TypeOf(c) Is RichEdit // Search for all TextBoxes and change appearance
c.borderstyle = 1
c.appearance = 0
c.fontsize = 11
c.height = c.height + 2
EndIf
If TypeOf(c) Is Label // Search for all labels and change appearance
If Len(c.caption)
c.top = c.top + 1
If Mid$(c.caption, 1, 2) = " >"
c.top = c.top - 1
c.height = c.height + 2
ElseIf Mid$(c.caption, 1, 1) = Chr$(51)
c.top = c.top - 1
c.height = c.height + 2
Else
c.fontsize = 11
c.backcolor = RGB(255, 255, 255)
c.Forecolor = RGB(100, 100, 100)
c.top = c.top - 1
EndIf
EndIf
EndIf
EndIf
If frm.Name = "frx1"
If TypeOf(c) Is TextBox // Search for all TextBoxes
c.borderstyle = 1
c.appearance = 0
c.fontsize = 11
c.height = c.height + 1
EndIf
/// ----------------
If TypeOf(c) Is Label // Search for all TextBoxes
If Len(c.caption)
If c.caption = " > Hat Kinder"
// mach nix
Else
// ***********************************************************************************
// This cause a crash in the editor for any reason
c.top = c.top + 1 // Access Violation //
// ***********************************************************************************
If Mid$(c.caption, 1, 1) = ">"
c.top = c.top - 1
c.height = c.height + 2
ElseIf Mid$(c.caption, 1, 1) = Chr$(51)
c.top = c.top - 1
c.height = c.height + 2
Else
c.fontsize = 10.5
c.backcolor = RGB(255, 255, 255)
c.Forecolor = RGB(100, 100, 100)
EndIf
EndIf
EndIf
EndIf
DoEvents
///-------------
EndIf
If frm.Name = "frx_Suchen"
// Find and change TextBoxes
If TypeOf(c) Is TextBox // Search for all TextBoxes
c.borderstyle = 1
c.appearance = 0
c.fontsize = 12
c.height = c.height + 5
EndIf
If TypeOf(c) Is Label // Search for all TextBoxes
If Len(c.caption)
c.top = c.top - 2
c.left = c.left - 5
c.height = c.height + 4
c.fontsize = 11
c.forecolor = 0
EndIf
EndIf
s%++
EndIf
EndIf
Next
i++
Next
Return s
EndFunction
Could it be better to set c and f each time prior "For Each * In *.Controls" to f and c = Nothing?
Set f = Nothing
For Each f In App.Forms
Set c = Nothing
For Each c In f.Controls
and same before returning the function?
Set f = Nothing
Set c = Nothing
return s
Return
I was able to fix the crash :
Update: There are some really crazy things going on here.
When changing the settings as you can see on the picture, then the error is solved if I save the source code once.
Then it possible to run in 4K and High res as well and all seems to be fine.
But why saving the code once helps?