Skip to content

Commit

Permalink
Fixed size of vsp terminal button and scaling of descriptor text box.
Browse files Browse the repository at this point in the history
  • Loading branch information
eriklins committed Aug 29, 2023
1 parent 80daee3 commit 85e1f42
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 89 deletions.
1 change: 0 additions & 1 deletion src/connect.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ object DeviceForm: TDeviceForm
VertScrollBar.Increment = 32
VertScrollBar.Page = 1
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = True
Color = clMenu
ParentBackground = False
ParentColor = False
Expand Down
25 changes: 12 additions & 13 deletions src/connect.pas
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,14 @@ procedure ConnectDevice(DevName: string; MacAddr: string; PerHandle: TSimpleBleP
DeviceFormElements[i].LabelServiceUuid[SvIdx].Hint := s;
end;
if BleConnectData[i].HasVspService then begin
DeviceFormElements[i].ButtonVspTerminal[SvIdx] := TButton.Create(DeviceForm[i]);
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Parent := DeviceFormElements[i].Panel[SvIdx];
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Tag := (i shl TagPosDev) or (SvIdx shl TagPosSrv);
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Caption := 'VSP Terminal';
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Top := DeviceFormElements[i].LabelServiceUuid[SvIdx].Top;
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Left := DeviceFormElements[i].Panel[SvIdx].Width - DeviceFormElements[i].ButtonVspTerminal[SvIdx].Width - DeviceFormPaddingHorizontal;
//DeviceFormElements[i].ButtonVspTerminal[SvIdx].Width := 64;
DeviceFormElements[i].ButtonVspTerminal[SvIdx].OnClick := @DeviceForm[i].ButtonVspTerminalClick;
DeviceFormElements[i].ButtonVspTerminal[SvIdx] := TButton.Create(DeviceForm[i]);
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Parent := DeviceFormElements[i].Panel[SvIdx];
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Tag := (i shl TagPosDev) or (SvIdx shl TagPosSrv);
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Caption := 'VSP Terminal';
DeviceFormElements[i].ButtonVspTerminal[SvIdx].AutoSize := true;
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Top := DeviceFormElements[i].LabelServiceUuid[SvIdx].Top;
DeviceFormElements[i].ButtonVspTerminal[SvIdx].Left := DeviceFormElements[i].Panel[SvIdx].Width - DeviceFormElements[i].ButtonVspTerminal[SvIdx].Width - DeviceFormPaddingHorizontal;
DeviceFormElements[i].ButtonVspTerminal[SvIdx].OnClick := @DeviceForm[i].ButtonVspTerminalClick;
end;
NextElementVertical := DeviceFormElements[i].LabelServiceUuid[SvIdx].Top + DeviceFormElements[i].LabelServiceUuid[SvIdx].Height + DeviceFormPaddingVertical;

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

DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx] := TEdit.Create(DeviceForm[i]);
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Parent := DeviceFormElements[i].Panel[SvIdx];
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].ReadOnly := true;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Top := NextElementVertical;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Left := 5*DeviceFormPaddingHorizontal;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Caption := 'TextBoxDescriptor';
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Font.Size := 10;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].MaxLength := 4;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Width := 56;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].AutoSize := false;
//DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Height := 20;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Width := 56;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Color := clForm;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Font.Size := 10;
DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].MaxLength := 4;
NextElementVertical := DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Top + DeviceFormElements[i].TextBoxDescriptor[SvIdx][ChIdx][DeIdx].Height + DeviceFormPaddingVertical div 2;

// read descriptor value, store in device data record and display in text box
Expand Down
Loading

0 comments on commit 85e1f42

Please sign in to comment.