Skip to content

Commit 85e1f42

Browse files
committed
Fixed size of vsp terminal button and scaling of descriptor text box.
1 parent 80daee3 commit 85e1f42

File tree

5 files changed

+141
-89
lines changed

5 files changed

+141
-89
lines changed

src/connect.lfm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ object DeviceForm: TDeviceForm
4141
VertScrollBar.Increment = 32
4242
VertScrollBar.Page = 1
4343
Anchors = [akTop, akLeft, akRight, akBottom]
44-
AutoSize = True
4544
Color = clMenu
4645
ParentBackground = False
4746
ParentColor = False

src/connect.pas

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,14 @@ procedure ConnectDevice(DevName: string; MacAddr: string; PerHandle: TSimpleBleP
303303
DeviceFormElements[i].LabelServiceUuid[SvIdx].Hint := s;
304304
end;
305305
if BleConnectData[i].HasVspService then begin
306-
DeviceFormElements[i].ButtonVspTerminal[SvIdx] := TButton.Create(DeviceForm[i]);
307-
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Parent := DeviceFormElements[i].Panel[SvIdx];
308-
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Tag := (i shl TagPosDev) or (SvIdx shl TagPosSrv);
309-
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Caption := 'VSP Terminal';
310-
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Top := DeviceFormElements[i].LabelServiceUuid[SvIdx].Top;
311-
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Left := DeviceFormElements[i].Panel[SvIdx].Width - DeviceFormElements[i].ButtonVspTerminal[SvIdx].Width - DeviceFormPaddingHorizontal;
312-
//DeviceFormElements[i].ButtonVspTerminal[SvIdx].Width := 64;
313-
DeviceFormElements[i].ButtonVspTerminal[SvIdx].OnClick := @DeviceForm[i].ButtonVspTerminalClick;
306+
DeviceFormElements[i].ButtonVspTerminal[SvIdx] := TButton.Create(DeviceForm[i]);
307+
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Parent := DeviceFormElements[i].Panel[SvIdx];
308+
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Tag := (i shl TagPosDev) or (SvIdx shl TagPosSrv);
309+
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Caption := 'VSP Terminal';
310+
DeviceFormElements[i].ButtonVspTerminal[SvIdx].AutoSize := true;
311+
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Top := DeviceFormElements[i].LabelServiceUuid[SvIdx].Top;
312+
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Left := DeviceFormElements[i].Panel[SvIdx].Width - DeviceFormElements[i].ButtonVspTerminal[SvIdx].Width - DeviceFormPaddingHorizontal;
313+
DeviceFormElements[i].ButtonVspTerminal[SvIdx].OnClick := @DeviceForm[i].ButtonVspTerminalClick;
314314
end;
315315
NextElementVertical := DeviceFormElements[i].LabelServiceUuid[SvIdx].Top + DeviceFormElements[i].LabelServiceUuid[SvIdx].Height + DeviceFormPaddingVertical;
316316

@@ -480,7 +480,6 @@ procedure ConnectDevice(DevName: string; MacAddr: string; PerHandle: TSimpleBleP
480480
DeviceFormElements[i].LabelDescriptorUuid[SvIdx][ChIdx][DeIdx].Caption := 'LabelDescriptorUuid';
481481
DeviceFormElements[i].LabelDescriptorUuid[SvIdx][ChIdx][DeIdx].Width := Round(DeviceFormElements[i].Panel[SvIdx].Width * 2 / 3);
482482
DeviceFormElements[i].LabelDescriptorUuid[SvIdx][ChIdx][DeIdx].AutoSize := false;
483-
//DeviceFormElements[i].LabelDescriptorUuid[SvIdx][ChIdx][DeIdx].Height := 18;
484483
DeviceFormElements[i].LabelDescriptorUuid[SvIdx][ChIdx][DeIdx].Font.Size := 10;
485484
if n = '' then
486485
DeviceFormElements[i].LabelDescriptorUuid[SvIdx][ChIdx][DeIdx].Caption := UpperCase(s)
@@ -493,15 +492,15 @@ procedure ConnectDevice(DevName: string; MacAddr: string; PerHandle: TSimpleBleP
493492

494493
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx] := TEdit.Create(DeviceForm[i]);
495494
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Parent := DeviceFormElements[i].Panel[SvIdx];
495+
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].ReadOnly := true;
496496
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Top := NextElementVertical;
497497
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Left := 5*DeviceFormPaddingHorizontal;
498498
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Caption := 'TextBoxDescriptor';
499-
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Font.Size := 10;
500-
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].MaxLength := 4;
501-
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Width := 56;
502499
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].AutoSize := false;
503-
//DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Height := 20;
500+
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Width := 56;
504501
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Color := clForm;
502+
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Font.Size := 10;
503+
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].MaxLength := 4;
505504
NextElementVertical := DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Top + DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Height + DeviceFormPaddingVertical div 2;
506505

507506
// read descriptor value, store in device data record and display in text box

0 commit comments

Comments
 (0)