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

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

방법입니다.


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



링크 주소

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 15469
공지 [UX Summit 요약] 오른쪽 클릭은 옳다 (Right Click is Right) 관리자 2020.11.16 13974
공지 [10.4 시드니] What's NEW! 신기능 자세히 보기 관리자 2020.05.27 16505
공지 RAD스튜디오(델파이,C++빌더) - 고객 사례 목록 관리자 2018.10.23 22062
공지 [데브기어 컨설팅] 모바일 앱 & 업그레이드 마이그레이션 [1] 관리자 2017.02.06 23276
공지 [전체 목록] 이 달의 기술자료 & 기술레터 관리자 2017.02.06 18933
공지 RAD스튜디오(델파이, C++빌더) - 시작하기 [1] 관리자 2015.06.30 39266
공지 RAD스튜디오(델파이,C++빌더) - 모바일 앱 개발 사례 (2020년 11월 업데이트 됨) 험프리 2014.01.16 174729
26 TFrame의 생성 및 해제를 편하게 해주는 TFrame 관리 클래스입니다.. file 푸른솔 2017.12.15 1739
25 모바일 앱 라이프사이클 이벤트 처리하기 Humphery 2015.04.09 1566
24 [XE8] 모바일 튜토리얼 무료 다운로드(영문), 총 364페이지 관리자 2015.07.09 1545
23 [XE7] iOS 시뮬레이터 배포 시 'Please specify exact device preset UUID.' 오류 대응 Humphery 2015.02.26 1536
22 파이어몽키 용 그리드 컴포넌트 안내 - FirePower Humphery 2015.02.23 1441
21 [무료 제공툴] 파이어몽키 스텐실(FMX Stencils) [3] 관리자 2018.08.24 1190
20 모바일 앱 라이프 사이클 이벤트 처리하기(앱 완전 구동 후 실행하기) [1] Humphery 2015.04.09 944
19 [개발자 Tip] 모바일 앱 개발 시 시간 낭비를 줄이는 Tip #1: 테스트하기 위해 기다리는 시간을 줄인다. 관리자 2016.12.26 884
18 10.2.3 새로운 기능: 파이어몽키 UI 템플릿 - 프로필 화면 관리자 2018.04.24 743
17 [XE8] 스피드버튼의 이미지를 크게 표시할 수 있습니다. Humphery 2015.06.04 704
16 모바일 앱 개발, 가장 좋은 선택은? 관리자 2021.03.18 610
15 파이어몽키 TListBox 컴포넌트 사용방법: 사용자 정의 아이템데이터 동적으로 표시하기 file 김원경 2020.01.20 609
14 파이어몽키를 사용하여 멀티 플랫폼/아키텍처 용 소프트웨어 개발 file 김원경 2020.03.25 597
13 그라데이션이 적용된 멋진 스타일을 적용하고 싶다면 - 스텔라(Stellar) FMX 스타일 관리자 2019.09.17 584
12 밝은 톤의 사용자 친화적인 디자인을 찾고있다면 - 푸에르토 리코(Puerto Rico) FMX 스타일 관리자 2019.09.17 526
11 FmxLinux - 델파이, RAD스튜디오에 추가되었습니다! 관리자 2019.06.26 507
10 iOS 앱스토어 1024x1024 아이콘 문제에 대한 해결 방법 김원경 2020.07.08 478
9 과감하면서도 볼드한 효과를 주고 싶다면 - Ruby Graphite FMX 스타일 관리자 2019.09.17 476
8 리눅스용 앱에 다양한 스타일 적용하기 (FMX 스타일들을 리눅스 앱에도!) 관리자 2019.09.17 467
7 리눅스 앱에 '윈도우 10 컬러 스타일'을 적용하고 싶다면 - Aqua Graphite 스타일 관리자 2019.09.09 438