i'm developing am aplication in delphi 2009.
in windows xp, this code works fine
X := 70;
Label1.Caption :=FloatToStr(X)+' %'; /// (70 %)
In Windows 7, same code generates a diferent label (% 70), the position of characters are changing, all operators are going to front.
Just so that the question has a coherent answer for any future visitors, the issue is the BiDiMode. The following screenshot shows a reproduction of the behaviour described in the question.
This was generated with the following DFM file.
object MyForm: TMyForm
object Label1: TLabel
Left = 8
Top = 8
Width = 23
Height = 13
BiDiMode = bdLeftToRight
Caption = '70 %'
ParentBiDiMode = False
end
object Label2: TLabel
Left = 5
Top = 24
Width = 23
Height = 13
BiDiMode = bdRightToLeft
Caption = '70 %'
ParentBiDiMode = False
end
end
Related
I’m trying to modify the color of the dot inside a radio button with Resource Hacker. I managed to change the color of the circle/frame but not the dot inside. I looked everywhere online and found similar examples but doesn’t exactly suit me with my situation. I guess all I need is the right syntax format. I tried so many different code combinations to no avail since I’m a newbie in coding. I’d really appreciate if you could help me out. The exact code I’m fiddling is below. Many thanks in advance.
object ScanCandidateGrp: TRzRadioGroup
Left = 103
Top = 34
Width = 64
Height = 66
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
TextShadowColor = clActiveBorder
GroupStyle = gsCustom
ItemFrameColor = clRed << I managed to change the circle color with this
ItemHotTrack = True
ItemHighlightColor = clBlue
ItemHotTrackColor = clGreen
ItemIndex = 0
Items.Strings = (
'Bob'
'Alex'
'Sue')
ParentFont = False
StartXPos = 2
StartYPos = 0
TabOrder = 0
Transparent = True
VerticalSpacing = 5
OnClick = ScanCandidateGrpClick
end
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.
(update: the XGetPixel problem has been solved thanks to David)
I am practicing some tasks from rosettacode.org for Standard ML, and I am stuck with the XGetImage call from XWindows (PolyML) . I get a badValue error for every attempt in XYPixmap format.
What I did, was
open XWindows ;
val disp = XOpenDisplay "" ;
val win = XCreateSimpleWindow (RootWindow disp) origin (Area {x=0,y=0,w=300,h=100}) 2 0 0xffffff ;
XMapWindow win;
XFlush disp ;
XGetImage win (Area {x=0,y=0,w=100,h=100}) AllPlanes XYPixmap ;
The XGetImage call returns
X Error BadValue in XGetImage
Exception- XWindows "XGetImage failed" raised
The xwindows.cpp source does not make me much wiser:
XImage *image = XGetImage(d,drawable,x,y,w,h,mask,CImageFormat(format));
if (image == 0) RaiseXWindows(taskData, "XGetImage failed");
ZPixmap + XGetPixel work fine in the most recent polyversion, the rest of this post has been solved:
When I try ZPixmap, i get
val im = XGetImage win (Area {x=0,y=0,w=1,h=1}) AllPlanes ZPixmap ;
val im =
XImage
{bitmapBitOrder = MSBFirst, bitmapPad = 32, bitmapUnit = 32,
bitsPerPixel = 1, byteOrder = MSBFirst, bytesPerLine = 4, data =
ImageData
"\^A\^#\^#\^# ... repeat 22 x .... \^A\^#\^#\^#",
depth = 24, format = ZPixmap, size =
Rect {bottom = 1, left = 0, right = 1, top = 0}, ...}
but
XGetPixel disp im (XPoint {x=0,y=0}) ;
crashes PolyML
The XGetImage example (in C) in the Xlib Programming Manual chapter 6.4.2 does not seem to do anything special, just use the display and a visible window. My window win is visible. I also tried the root window, and that does not work either. I think I have followed the PolyML for X manual correctly.
What is missing here ?
It seems there was a bug in the code that implemented XGetPixel in Poly/ML. There is a fix for that now in the github repository. I'm not familiar enough with X-windows to be able to say whether it should work with XYPixmap.
I am creating a cross platform data aware app for windows and os x using Delphi 10.1 Berlin and firebird. My Mac is running El Capitan. My PC is running in Parallels virtual machine on the Mac.
The app on each platform is to connect to a firebird 2.5 server located on a Win 2008 server. The win32 version compiles and connects without a problem. The one for OS X, however, does not.
I have already downloaded and installed FB 2.5 on my Mac and set up PAserver properly. For example, I have been able to connect to firebird on the Windows server from my Mac using RazorSQL. I have also been able to compile a very simple "Hello world" project with just a button and a ShowMessage dialog and run it on the Mac. So, I am sure PAserver is running correctly.
I created a barebones data aware application for testing. Here is the form in text format:
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 480
ClientWidth = 640
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
DesignerMasterStyle = 0
object StringGrid1: TStringGrid
Align = Client
CanFocus = True
ClipChildren = True
Size.Width = 640.000000000000000000
Size.Height = 440.000000000000000000
Size.PlatformDefault = False
TabOrder = 0
RowCount = 0
Viewport.Width = 636.000000000000000000
Viewport.Height = 415.000000000000000000
end
object ToolBar1: TToolBar
Size.Width = 640.000000000000000000
Size.Height = 40.000000000000000000
Size.PlatformDefault = False
TabOrder = 7
object NavigatorBindSourceDB1: TBindNavigator
Position.X = 176.000000000000000000
Position.Y = 7.000000000000000000
Size.Width = 241.000000000000000000
Size.Height = 25.000000000000000000
Size.PlatformDefault = False
TabOrder = 0
DataSource = BindSourceDB1
xRadius = 4.000000000000000000
yRadius = 4.000000000000000000
end
end
object FDConnection1: TFDConnection
Params.Strings = (
'Database=E:\Shared Folders\Employees\Firebird\Databases\Test.fdb'
'User_Name=SYSDBA'
'Password= (intentionally deleted)'
'Protocol=TCPIP'
'Server=afmsasrv'
'Port=3024'
'ExtendedMetadata=True'
'CharacterSet=win1252'
'DriverID=FB25')
Connected = True
LoginPrompt = False
Left = 440
Top = 112
end
object FDGUIxWaitCursor1: TFDGUIxWaitCursor
Provider = 'FMX'
Left = 344
Top = 120
end
object FDTable1: TFDTable
Active = True
IndexFieldNames = 'ID'
Connection = FDConnection1
UpdateOptions.UpdateTableName = 'PERSON'
TableName = 'PERSON'
Left = 272
Top = 128
end
object DataSource1: TDataSource
DataSet = FDTable1
Left = 216
Top = 128
end
object BindSourceDB1: TBindSourceDB
DataSet = FDTable1
ScopeMappings = <>
Left = 304
Top = 224
end
object BindingsList1: TBindingsList
Methods = <>
OutputConverters = <>
Left = 20
Top = 5
object LinkGridToDataSourceBindSourceDB1: TLinkGridToDataSource
Category = 'Quick Bindings'
DataSource = BindSourceDB1
GridControl = StringGrid1
Columns = <>
end
end
end
When I run the project I get the error below:
[FireDAC][Phys]-300. Driver [FB25] is not registered. Correct driver ID or define [FB25] virtual driver in FDDrivers.ini'. Process Project1 (1114)
I have added FDDrivers.ini to my project, as indicated in Embarcadero's FireDac documentation. Here are the contents.
[FDDrivers.ini]
Encoding=UTF8
[FB25]
; FB25 virtual driver will use specified Firebird client library
BaseDriverID=FB
VendorLibWin32=C:\firebird\fb25_W32\bin\fbclient.dll
VendorLibWin64=C:\firebird\fb25_64\bin\fbclient.dll
VendorLibOSX32=/Library/Frameworks/Firebird.framework/Libraries/Versions/A/libfbclient.dylib
Any ideas on how to get this to work?
I have a large VB6 app with many .frm files. I want to basically 'gut' the code from all the forms and just leave the GUI design.
What would be the best way to perform this task quickly?
If you really have enough forms that you can't just open each form and Ctrl + A, Del, Ctrl + S Then you can always write a quick VB program to do it. Visual Basic puts the information needed to display the form at the beginning of the file followed by the code. Copy each .frm file to a backup, open it and write everything up to the last Attribute ... line to a new file with the original file name. Pretty dirty, but should only take about 15-20 minutes to write and leaves you a backup in case of error.
Sample .frm content
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 1800
TabIndex = 1
Top = 1320
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
Left = 360
TabIndex = 0
Text = "Text1"
Top = 240
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Text1.Text = "Hello World"
End Sub
Private Sub Form_Load()
Text1.BackColor = vbBlue
End Sub
Guess this is an old question, but if you're still interested in refactoring some VB6 project, check out my VBFormDesign filter tool at http://zoomicon.com/tranxform/