델파이가 지원하는 기본 버튼 혹은 기본 컴포넌트는 아이폰의 인터페이스와 다른 모양을

가지고 있어서 아이폰의 인터페이스와 비슷한 모양으로 바꾸고 싶을때 유용하게 사용할 수 있는

방법입니다.


기본적으로 스타일을 변경해서 이용하는 방법입니다.



링크 주소

http://jed-software.com/blog/?p=609




In this post we’ll discover and solve a couple of glitches in the default styles supplied in FireMonkey for iOS.

  • Create a new FireMonkey iOS HD application.
  • Drop a button on the form and assign an OnClick handler.
  • In the OnClick handler, add code to display a simple message.
    • i.e. ShowMessage(‘You tapped me!’);
  • Run the application (you can do this on windows without going to XCode for this post)
  • Tap/Click on the button

Problem 1 – The default TButton style doesn’t look different when it has been pressed.

To fix this issue stopped the application and perform the following steps.

Right click on the TButton component and select the Edit Default Style… command at the bottom of the context menu.

The Style Designer will load and since we are updating the Default Style, will have the default style name for TButton, which is Buttonstyle.

The style consists of a TLayout, three TRectangle and a TText control.

To rectify the pressed state, grab a TInnerGlowEffect component from the Tool Palette.

Drag the TInnerGlowEffect component from the Tool Palette and drop it on the background TRectangle control.

With the TInnerGlowEffect component selected, you can see the available properties for the control.

Change the GlowColor property to better suit this situation, I chose Black.
Set the Enabled property to False. This is because we only want this effect enabled when the button is being pressed.
In the Trigger property, enter the following “IsPressed=true“. This means then whenever the IsPressed property is true, this effect will become enabled.

After your changes, you object inspector should look like the capture below.

Run the application now and hopefully you will see the effect display when the button is pressed.

Drop a couple of TCornerButton controls on the same application. Set the XRadius and YRadius values to 10 for one of the corner buttons. The sample application should now look something like the capture below.

Problem 2 – Under side of corner button looks strange when XRadius and YRadius values are not 3.

Below is a close up to better display the issue, it is really noticeable if your background is lighter.

To discover what is occuring with this style issue, we need to inspect the source code. Most importantly where the style information is loaded by the corner button control. In FireMonkey style properties should be modified in the ApplyStyle or ApplyStyleLookup methods. The ApplyStyle method for the TCustomCornerButton control is below, seems like everything should work.

Lets take a look at the default style for a TCornerButton.

Hmm, the source code referenced a StyleName called ‘secondbackground‘ button second background has been been set. The TRectangle without a name next to it should be called ‘secondbackground‘.

Use the object inspector to set the StyleName of the un-style-named TRectangle to ‘secondbackground‘.

Successful renaming is identified by your style, looking like the style in the capture below. Don’t set the name property by accident. You can’t set the name property to anything for a style (and have it persist).

Now when you view the form the corner button style won’t looked odd.

Problem 3 – The cornerbutton doesn’t show any effect when it is pressed.

Note how there is no TInnerGlowEffect define for the style. Follow the same steps above for the TButton and add the same effect (with the same property values) to the corner button style. Parent the TInnerGlowEffect to the background TRectangle control.

Problem 4 – The corner button has a TGlowEffect.

Kind of useless in a mobile application which doesn’t have a tab key to navigate between controls! Delete the TGlowEffect component from the style by clicking on the X.

Now you can rebuild and deploy to XCode and run on iOS to make sure these changes work well. Here is a capture from a real iPad (really it is!).

Default Styles

When in the Style Designer you can use the Load Default button to load all of the style details for the applications default style. This allows you to inspect other styles to learn from them. After making changes, I recommend you save the modified style to disk for safe keeping.

I would attach the modified style file to this post for download, but I’m not sure if I’m allowed to.

 

I’ve been doing a quite a bit of work with FireMonkey styles lately trying to make a nice TListBoxItem style. You may hear more about this in the future…


번호 제목 글쓴이 날짜 조회 수
공지 [DelphiCon 요약] 코드사이트 로깅 실전 활용 기법 (Real-world CodeSite Logging Techniques) 관리자 2021.01.19 15441
공지 [UX Summit 요약] 오른쪽 클릭은 옳다 (Right Click is Right) 관리자 2020.11.16 13962
공지 [10.4 시드니] What's NEW! 신기능 자세히 보기 관리자 2020.05.27 16499
공지 RAD스튜디오(델파이,C++빌더) - 고객 사례 목록 관리자 2018.10.23 22055
공지 [데브기어 컨설팅] 모바일 앱 & 업그레이드 마이그레이션 [1] 관리자 2017.02.06 23268
공지 [전체 목록] 이 달의 기술자료 & 기술레터 관리자 2017.02.06 18923
공지 RAD스튜디오(델파이, C++빌더) - 시작하기 [1] 관리자 2015.06.30 39257
공지 RAD스튜디오(델파이,C++빌더) - 모바일 앱 개발 사례 (2020년 11월 업데이트 됨) 험프리 2014.01.16 174713
503 [발표자료] RAD Studio XE8 출시 세미나 관리자 2015.05.01 612
502 [업데이트][핫픽스][XE8] iOS 플랫폼의 SQLite 라이브러리 누락 패치 file Humphery 2015.04.30 859
501 [XE8] 번거로운 수작업을 줄여 핵심기능 개발에 집중할 수 있는 개발 생산성 향상도구 Humphery 2015.04.28 897
500 [XE8] TAppAnalytics 컴포넌트로 앱의 사용량 수집, 분석해 사용성을 이해할 수 있습니다. file Humphery 2015.04.27 803
499 델파이에서 MSOffice 엑셀과 워드 연동 참고자료. [1] Humphery 2015.04.27 3772
498 이 달의 기술자료 - 2015년 05월 file 험프리 2015.04.24 5494
497 [델파이7 이후 새로운 기능][XE2~] 프로젝트 매니저에서 타겟플랫폼을 64-bit Windows로 선택 해 64비트 애플리케이션을 개발할 수 있습니다. file Humphery 2015.04.23 4723
496 [델파이7 이후 새로운 기능] 추가되고 개선된 VCL 컴포넌트 Humphery 2015.04.22 3576
495 [델파이7 이후 새로운 기능] 코딩 생산성을 높여주는 코드에디터 기능들 Humphery 2015.04.21 2692
494 XE8로 구현한 멀티플랫폼 클립보드 공유앱 런칭 file c2design 2015.04.19 1185
493 Thalmic Labs의 MYO Armband Delphi SDK Beta7입니다. 쭈니아빠 2015.04.18 1135
492 [XE8] 오프라인에서 도움말을 볼 수 있습니다.(CHM 형식) Humphery 2015.04.17 926
491 [XE8] 대화형 지도 컴포넌트로 구글맵과 애플 맵킷 한번에 사용하기 Humphery 2015.04.17 1650
490 [XE8] 멀티-디바이스 미리보기: 다양한 디바이스 화면을 미리보며 최적화된 화면 개발하기 Humphery 2015.04.17 1132
489 XE8 새로운 기능외의 개선사항 Humphery 2015.04.16 925
488 [XE8] 버전 컨트롤 시스템 IDE 통합(Mercurial 지원) [1] Humphery 2015.04.15 1376
487 [XE8] 근거리 위치기반 서비스를 개발할 수 있는 비콘(Beacon) 연동하기 [1] Humphery 2015.04.15 3941
486 [업데이트][XE7] iOS 8.1.3/8.2 서명과 프로비저닝 프로파일 지원 핫픽스(베타) Humphery 2015.04.14 1055
485 파이어몽키에서 외부 라이브러리 연동하기(jar, so, a) [3] Humphery 2015.04.14 3547
484 [따라하기] reFind 도구를 이용해 BDE 프로젝트를 FireDAC으로 마이그레이션 따라하기 [9] Humphery 2015.04.14 4146