File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -887,7 +887,11 @@ defmodule Scenic.Driver do
887887 name: [ type: :atom ]
888888 ]
889889
890- @ doc false
890+ @ doc """
891+ Validate driver configuration
892+
893+ Used primarily for dynamic view port creation
894+ """
891895 def validate ( [ ] ) , do: { :ok , [ ] }
892896
893897 def validate ( drivers ) do
Original file line number Diff line number Diff line change @@ -91,6 +91,22 @@ defmodule Scenic.ViewPort do
9191 leave the scene that thinks it has "captured" the input in an inconsistent
9292 state, so this is not recommended.
9393
94+ ## Dynamically Creating View Ports
95+
96+ Pass in the same set of opts that you would use when starting `Scenic` in your
97+ supervision tree. For example:
98+
99+ # Assuming you use the default view port name from the generator
100+ {:ok, view_port} = Scenic.ViewPort.info(:main_viewport)
101+
102+ opts = [
103+ module: Scenic.Driver.Local,
104+ window: [resizeable: false, title: "My Example Scenic App"],
105+ on_close: :stop_system
106+ ]
107+
108+ {:ok, [opts]} = Scenic.Driver.validate([opts])
109+ Scenic.ViewPort.start_driver(view_port, opts)
94110 """
95111
96112 @ type t :: % ViewPort {
You can’t perform that action at this time.
0 commit comments