[FMX] Firemonkey delphi android beep sound

 Uses

   Androidapi.Helpers,

   Androidapi.JNIBridge,

   Androidapi.JNI.Media,

   AndroidApi.Jni.JavaTypes,

   AndroidApi.Jni.App;


procedure BeepSound();

{$IFDEF ANDROID}

var

  AudioObj: JObject;

  Audio: JAudioManager;

{$ENDIF}

begin

{$IFDEF ANDROID}

  AudioObj:= TAndroidHelper.Activity.getSystemService( TJActivity.JavaClass.AUDIO_SERVICE);

  Audio := TJAudioManager.Wrap((AudioObj as ILocalObject).GetObjectID);

  Audio.loadSoundEffects;

  Audio.playSoundEffect( 8 );  // 0 ~ 9 

{$ENDIF}

end;


[TMS] Introduction of TAdvStringGrid function - How to link to cell and use balloon help


TAdvStringGrid 의 cell 항목에 외부링크를 연결하여 웹브라우저를 호출 할 수 있고
Grid 내부에서 특정셀로 이동하도록 하는 링크를 넣을 수 있습니다.
하단 샘플 소스와 같이 하이퍼링크 방식의 텍스트를 입력 합니다


풍선 도움말은 TAdvStringGrid 의 Balloon 옵션의 Enable를 TRUE 로  먼저 설정 해야 합니다.
옵션 항목 중 ShowCell 항목은 입력된 데이터도 풍선 도움말로 보여주므로 불 필요시 FALSE 로 지정 하면 됩니다.
AddBalloon 메소드를 사용하여 필요한 메시지를 입력 하면 됩니다.


 with AdvStringGrid1 do begin
      Cells[2, 2] := '<A href="http://www.devgear.co.kr">Click here</A><BR>for more';    // 웹페이지 연결
      Cells[2, 3] := '<A href="CELL://R8C1">Link to cell 1,8</A>';                       // 특정 셀로 이동
      Cells[1, 8] := '<A href="CELL://R3C2">Link to cell 2,3</A>';                       // 특정 셀로 이동

      AddBalloon(1,1,'Title A','Cell 1,1 is here', biError);     //   TBalloonIcon = (biNone, biInfo, biWarning, biError);
      AddBalloon(3,3,'Title B','Cell 3,3 is here', biWarning);
   end;








[TMS] TAdvStringGrid function introduction - How to specify cell item data color

 image.png

TAdvStringGrid에 입력된 데이터 종류에 따라 폰트 색상을 지정 하는 방법에 대한 샘플 입니다.

값을 양수와 음수로 구별하여 각기 다른 색상을 지정 하게 하였고 앱이 실행된 런타임 상태에서도 색상을 변경 할 수 있게 합니다.

TAdvStringGrid 의 OnGetCellColor 메소드가 사용 되었습니다.



procedure TForm1.Button1Click(Sender: TObject);

var

  i, j: Integer;

begin

  for i := 1 to AdvStringGrid1.RowCount - 1 do

    for j := 1 to AdvStringGrid1.ColCount - 1 do

      AdvStringGrid1.Ints[j, i] := Random(1000) - 500;

end;


procedure TForm1.AdvStringGrid1GetCellColor(Sender: TObject; ARow, ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont);

begin

  if AdvStringGrid1.Cells[ACol, ARow] <> '' then

    if AdvStringGrid1.Ints[ACol, ARow] < 0 then

    begin

      ABrush.Color := ColorGrid2.BackgroundColor;

      AFont.Color := ColorGrid2.ForegroundColor;

    end

    else

    begin

      Abrush.Color := Colorgrid1.BackgroundColor;

      AFont.Color := Colorgrid1.ForegroundColor;

      AFont.Style := [fsBold];

    end;

end;


procedure TForm1.ColorGrid1Change(Sender: TObject);

begin

  AdvStringGrid1.Invalidate;

end;


procedure TForm1.FormCreate(Sender: TObject);

begin

  Button1Click(Sender);

end;



[TMS] TAdvStringGrid function introduction - csv file import and sorting

 ​




TMS 의 TAdvStringGrid 에서  LoadFromCSV 메소드를 사용하면  csv 파일을 불러 올 수 있습니다.

Grid 의 Column 과 Row 는 csv 데이터 항목 수에 맞게 자동으로 세팅 됩니다.

 

컬럼 헤드 클릭시 Sorting 명령을 수행 하기 위해서 아래와 같이 설정 힙니다.

AdvStringGrid1.SortSettings.Show := TRUE;  

Sorting 관련해서 다양한 옵션들이 제공 됩니다. 상세 기능은 세부 메뉴얼을 참고 하시기 바랍니다.


Grid Column 의 헤드 타이틀 항목을 클릭하여 soting 하기 위해서는 다음의 3가지 이벤트 메소드가 활용 됩니다.
dosort 항목을 TRUE 로 지정하면 Sorting이 가능해지며 아래 코드는 0 번 Column 은 클릭 Disable 됨을 의미 합니다.

dosort := acol > 0;   

procedure TMvForm.Button1Click(Sender: TObject);
begin
  AdvStringGrid1.LoadFromCSV( 'c:\temp\cdata.csv' );
  AdvStringGrid1.SortSettings.Show := TRUE;
  AdvStringGrid1.ColWidths[ 2 ] := 100;
end;

procedure TMvForm.AdvStringGrid1CanSort(Sender: TObject; ACol: Integer; var DoSort: Boolean);
begin
  dosort := acol > 0;

  Cursor := crHourGlass;
end;

procedure TMvForm.AdvStringGrid1ClickSort(Sender: TObject; ACol: Integer);
begin
  Cursor := crDefault;
end;


procedure TMvForm.AdvStringGrid1GetFormat(Sender: TObject; ACol: Integer; var AStyle: TSortStyle; var aPrefix, aSuffix: string);
begin
  case acol of
    1:  AStyle := ssAlphabetic;   // ssAlphanocase;
    2:  AStyle := ssNumeric;
    3:  AStyle := ssNumeric;
    4:  AStyle := ssDate;
  end;
end;