C++ Builder 10.4, FMX: Form TabOrder problem - firemonkey

The Tab functionality to switch between control fields seems to be not working with C++ Builder 10.4 (with patch 1, 2 and 3), if a form control which contains some taborder fields, gets another parent form control programmaticly.
This can be reproduced very easily by creating a Multi-Device Application, with just 2 TLayout-controls and 2 TEdit-controls on a form:
Steps to reproduce:
Create a new Multi-Device Application, Blank Application. This will create a Unit1 with a blank form.
For the generated Unit1, just drop a TLayout from the Palette to the form and resize this to match almost the left half of the form.
Drop a second TLayout control on the form (Layout2) and resize this layout to match the right half of the form.
Drop 2 TEdit control fields on Layout1 (Edit1 and Edit2).
For Layout1, set the TabOrder property to 0, and make sure the property TabStop is set to True.
For Layout2, set the TabOrder property to 1, and make sure the property TabStop is set to True.
For Edit1, set the TabOrder property to 0, make sure the property TabStop is set to True, and set text to "edit1".
For Edit2, set the TabOrder property to 1, make sure the property TabStop is set to True, and set text to "edit2".
Build and run the project: The form with 2 edit fields appears and with Tab you can switch between the fields. This is OK! If the value of the Layout1 property TabOrder is kept to be -1, the Tab is also working, but only after selecting 1 of the edit fields with a mouse-click.
Now, in the constructor of TForm1 program Layout2 as the parent of Layout1:
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.fmx"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Layout1->Parent = Layout2;
}
Build and run the project again. The position of the edit fields on the form is now changed to the right as expected. But there the Tab functionality is gone!
Why? If the same steps are executed in C++ Builder 10.2, the Tab functionality keeps working after setting the parent of Layout1 to Layout2.
Content of Unit1.fmx, as requested by "Schneider Infosystems Ltd":
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 480
ClientWidth = 640
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
OnShow = FormShow
DesignerMasterStyle = 0
object Layout1: TLayout
Position.X = 8.000000000000000000
Position.Y = 8.000000000000000000
Size.Width = 305.000000000000000000
Size.Height = 409.000000000000000000
Size.PlatformDefault = False
TabOrder = 0
object Edit1: TEdit
Touch.InteractiveGestures = [LongTap, DoubleTap]
TabOrder = 0
Text = 'edit1'
Position.X = 64.000000000000000000
Position.Y = 72.000000000000000000
end
object Edit2: TEdit
Touch.InteractiveGestures = [LongTap, DoubleTap]
TabOrder = 1
Text = 'edit2'
Position.X = 64.000000000000000000
Position.Y = 112.000000000000000000
end
end
object Layout2: TLayout
Position.X = 328.000000000000000000
Position.Y = 8.000000000000000000
Size.Width = 305.000000000000000000
Size.Height = 409.000000000000000000
Size.PlatformDefault = False
TabOrder = 1
end
end

Yes!
It works after installing "C++ Builder 10.4.1" !
So, it was a bug in 10.4.
I have to do a lot more actions to build and test all existing software I care about, but I am happy that the TAB-key functionallity seems to be solved! :)
I had to do a complete deïnstall and install of RadStudio. Also third party software has to be integrated again in the IDE. A lot of work. I keep wondering why this was necessary, and could not be solved with patch updates with "GetIt" in version 10.4.

Related

TGauge doesn't change value in runtime

At first, please bear with me, as I am quite new to the Delphi world. I am a former C++, C# and embedded developer.
I have Delphi 7 and Delphi RAD Studio 10.2 Starter on Windows 7 64-bit.
I have tried the TGauge component in both versions, as it is standard in Delphi (I think).
So, the issue is when I try to set the Progress property with a value at run-time, it doesn't reflect that on the GUI. But, if I set a value at design-time from the Object Inspector, it reflects the value as it should be, and the Gauge
paints the percentage correctly.
Steps to test this behavior:
Dragged and dropped the TGauge component from the "Samples" palette onto the Form.
I set MaxValue = 100 and MinValue = 0 in the Object Inspector.
I created a textbox (txtValue) on the Form.
I created a button (btnSetValueClick) on the Form and used this code:
procedure TMainForm.btnSetValueClick(Sender: TObject);
begin
Gauge1.Progress := StrToInt(txtValue.Text);
end;
So, I was expecting the Gauge would show the value entered, but it didn't.
When I debug the code, it hits btnSetValueClick() and sets the value inside.
What am I missing here?
EDIT: (This is the code in the form.)
object Gauge1: TGauge
Left = 53
Top = 81
Width = 191
Height = 113
ParentCustomHint = False
Color = clMenu
ForeColor = clRed
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Default'
Font.Style = []
Kind = gkNeedle
ParentColor = False
ParentFont = False
Progress = 35
EDIT:
I have created a new project and started from scratch. I put the TGauge without changing any single properties of it. And it has started to work although I don't still see the difference can cause this behavior. At least this might give a clue this component can go wrong without an obvious reason, especially to beginners like me.
Please consider the case is as closed. Thank you.

Form property automatically changing on saving changes in VB6 (configured with VSS 2005)

I am facing below issue in VB6 :
When I checkout file file and check "Show differences" it is showing no difference (identical files) but when I save my changes without changing and form property and again check for differences in VSS , it is showing difference in few property.One of them is mentioned below.Kindly suggest.
Begin VB.Label CommStatus
BackColor = &H80000014&
BorderStyle = 1 'Fixed Single
BeginProperty Font
**Name = "Arial"** 'this property is changing
Size = 8.25
Charset = 204
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 375
Left = 240
TabIndex = 3
ToolTipText = "The most recently detected error"
Top = 360
Width = 7815
End
You can check attach image
After looking in to this, the reason for seems to be Windows zoom setting (100%,125% and 150%, control panel/Make text and other items larger or smaller). If the form is checked in to TFS/VSS/GIT in one zoom setting, and later edited in another, VB6 will change all kind of form properties to adjust for this. So this probably only happens in dev teams with 2+ users that happens to have different screen sizes and therefor different zoom settings.
Only way to avoid this is probably to all use the same zoom setting...

VB6 Change Background Colour of ListView Item

Refering to Change background color of listview in vb6
I tried this example and does not work as in I see no coloured rows.
I have a command button on my form that loads listview items then once that is finished I call the routine to setup the colour.
I made my picture box visible to see the expected outcome and it is as expected. So effectively setting the ListView's Picture property to the PictureBox's Image property is doing nothing for me.
Anyhow this is my code:
'pbxBG.Visible = True
If lsvPersonalisation.ListItems.Count <> 0 Then
pbxBG.Width = lsvPersonalisation.Width
pbxBG.Height = lsvPersonalisation.ListItems(1).Height * (lsvPersonalisation.ListItems.Count)
pbxBG.ScaleHeight = lsvPersonalisation.ListItems.Count
pbxBG.ScaleWidth = 1
pbxBG.DrawWidth = 1
pbxBG.Cls
Dim i As Integer
For i = 1 To lsvPersonalisation.ListItems.Count
If lsvPersonalisation.ListItems(i).Tag = "1" Then
pbxBG.Line (0, i - 1)-(1, i), &H80FFFF, BF
Else
pbxBG.Line (0, i - 1)-(1, i), &HFFFFFF, BF
End If
Next i
Else
pbxBG.Cls
End If
lsvPersonalisation.Picture = pbxBG.Image
'pbxBG.Visible = False

Win7: Set Custom Text Size changes position of button's image

Good day all! I have a very tricky for me question.
In my application I have button with image inside. All properties of this button:
Me.cmdSelectAll.BackColor = System.Drawing.SystemColors.Control
Me.cmdSelectAll.Image = CType(resources.GetObject("cmdSelectAll.BackgroundImage"), System.Drawing.Image)
Me.cmdSelectAll.ImageAlign = Drawing.ContentAlignment.BottomRight
Me.cmdSelectAll.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdSelectAll.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cmdSelectAll.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdSelectAll.Location = New System.Drawing.Point(0, 282)
Me.cmdSelectAll.Name = "cmdSelectAll"
Me.cmdSelectAll.Padding = New System.Windows.Forms.Padding(0, 0, 0, 0)
Me.cmdSelectAll.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdSelectAll.Size = New System.Drawing.Size(22, 22)
Me.cmdSelectAll.TabIndex = 11
Me.cmdSelectAll.TabStop = False
Me.ToolTip1.SetToolTip(Me.cmdSelectAll, "Select All Channels")
Me.cmdSelectAll.UseVisualStyleBackColor = False
When I run it with default text size of win7, the image appears in the center, it's all ok. But when I set some custom value of text size (115%) my image suddenly goes more right and down. It occurs with all of my button's images. Could you please answer me why does this happen and how can i fix this issue? Thanks

How to make buttons stay pressed using corona

I am trying to get my buttons to stay "pressed" once it is released. Right now I am using the improved Buttons Module for corona and I have the default image being the button looking unpressed, and the over image being replaced by an image that looks pressed.
What I am trying to do is once the button is pressed, it stays on the over image. Here is how my code is set up for the button I am testing it on.
local digButton = buttons.newButton{
default = "digButton.png",
over = "digButtonPressed.png",
onEvent = digButtonFunction,
id = "dig"
}
digButton:setReferencePoint(display.CenterReferencePoint)
digButton.x = display.contentWidth/5
digButton.y = display.contentHeight/1.9
Also, I have a function (digButtonFunction) that sets the id of this button to a variable to be used to run an if statement for when the user pushes a button following this one.
This sounds to me like what you really want is a switch. Buttons are not really designed from a UI perspective to do that. The down-state is there just to give feedback to the user that some action happened.
If it were me, I'd not use the button bit at all, but load in to images using display.newImageRect() and draw the downstate first, then the upstate. Built a touch event listener on each one that will hide one or the other. I do this in my games for my sound on/off buttons.
local soundOn = true
local soundOnBtn, soundOffBtn
local function soundToggle(event)
if soundOn then
soundOn = false
soundOnBtn.isVisible = false
soundOffBtn.isVisible = true
else
soundOn = true
soundOnBtn.isVisible = true
soundOffBtn.isVisible = false
end
return true
end
soundOnBtn = display.newImageRect("images/switch_on.png", 46, 36)
soundOnBtn.x = display.contentWidth / 2 + 25
soundOnBtn.y = display.contentHeight / 2 - 15
group:insert(soundOnBtn)
soundOnBtn:addEventListener("tap", soundToggle)
soundOffBtn = display.newImageRect("images/switch_off.png", 46, 36)
soundOffBtn.x = display.contentWidth / 2 + 25
soundOffBtn.y = display.contentHeight / 2 - 15
group:insert(soundOffBtn)
soundOffBtn:addEventListener("tap", soundToggle)
soundOffBtn.isVisible = false

Resources