Slide 1

Slide 1 text

4D Summit 2012 Creating Custom Widgets

Slide 2

Slide 2 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Keisuke Miyako Technical Account Manager

Slide 3

Slide 3 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Want to know about Widgets?

Slide 4

Slide 4 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Then Read the Documentation! ...but which part?

Slide 5

Slide 5 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Language Reference •Form event osearch for “subforms”, not “widgets”

Slide 6

Slide 6 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Design Reference •Subforms and widgets owidgets, a.k.a. “page subforms”

Slide 7

Slide 7 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Need to get the language straight! widgets? subforms?

Slide 8

Slide 8 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Taxonomy •Widget opage subform with a bound variable •Widget Form o form used as the content of a widget •Parent Form oform that host a widget form •Container osubform object used as a widget

Slide 9

Slide 9 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Some Bad News...

Slide 10

Slide 10 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Limitations •Printing onot supported... •Cross window interaction onot supported... •Add to standard object library onot supported...

Slide 11

Slide 11 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Some Good News!

Slide 12

Slide 12 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA New in v13 •FORM Get current page * oadds widgets support •FORM GOTO PAGE * oadds widgets support actually, works in v12, just undocumented... •OBJECT GET/SET SUBFORM •OBJECT GET SUBFORM CONTAINER SIZE

Slide 13

Slide 13 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Basics

Slide 14

Slide 14 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Things to know •Event de fi nition oOn Load, On Activate •Event sequence oWidget before Parent •Component architecture oWrapper methods oContext: Component ≠ Widget

Slide 15

Slide 15 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Best practices •Form local variables oAlso useful for private local storage •Naming convention oObjects, pointer to objects oWrapper method pre fi xes •Macros v2 oTemplates oDocumentation

Slide 16

Slide 16 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA More than the basics

Slide 17

Slide 17 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Ask yourself... •Do I need to support page 2? oif not, coding is easier... •Could the layout be static? oif yes, coding is easier... •Do I need to stay on v12? oon v13, coding is easier...

Slide 18

Slide 18 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Page 2 support •Different event sequence oNo On Load in parent oMultiple On Load’s in widget •Solution oVirtual form event (-On Load) oOn Timer oOn Page Change (v13)

Slide 19

Slide 19 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Dynamic layout support •Container size oVirtual form event (-On Load) with EXECUTE METHOD IN SUBFORM ov13 OBJECT GET SUBFORM CONTAINER SIZE •Timing oWidgets on page 2 initially don’t exist •Resize? o forget it... (especially on page 2)

Slide 20

Slide 20 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Dynamic layout support •Pages inside widget oOf fi cially supported in v13! •SVG oSVG SET ATTRIBUTE * •WebArea o JavaScript

Slide 21

Slide 21 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Questions?

Slide 22

Slide 22 text

Creating Custom Widgets Summit 2012, Silicon Valley, CA Thank You! https://github.com/miyako/ plugins, components, widgets... https://twitter.com/kmiyako/ sources.4d.com updates [email protected]