Code Monkey home page Code Monkey logo

viup's Introduction

VIUP

VIUP is a work-in-progress V wrapper for the C-based cross-platform UI library, IUP. The aim of this library is to provide a thorough implementation of IUP in V. The implmentation is faithful to the original API but takes some liberties to provide a native "V" feel and modernizes some of the calls.

Windows Gallery Example Linux (Ubuntu) Gallery Example

Features

  • image
    • load image
    • convert image to native
    • convert native to image
  • basic controls
  • containers
  • dialogs
  • gl
    • gl rendering
    • gl controls
  • scintilla
  • plot
  • extra controls
  • clipboard
  • browser

Setup

  1. Download the appropriate runtime libraries for your Operating system: https://sourceforge.net/projects/iup/files/3.30/
  2. If using image functions, download IM runtime libraries: http://webserver2.tecgraf.puc-rio.br/im/

Windows install

Copy all applicable DLLs from Zip to binary directory. By default, only iup.dll is required. If using image functions, iup_im.dll is required as well as all of the DLLs frmo the IM library.

Windows App Manifest

Windows UI apps need to be built with a Manifest. This manifest includes details about the app such as the name, version, and characteristics. VIUP includes a basic manifest with the gallery that can be easily modified. The generated manifest.syso needs to be in the directory during build but does not need to be distributed with your application.

To update the manifest:

cd winmanifest windres -i resources.rc -o manifest.syso -O coff

Copy manifest.syso to application directory.

Note: Currently running v . or v run . will not find the .syso file correctly. To include it in your project, add a #flag windows "path\\to\\file\\manifest.syso to the top of your application.

Linux install

Extract runtime libraries to a folder and run sudo ./install to install libraries.

Libraries Path

I've noticed in testing that the libraries are installed to /usr/lib64. It does not appear that they are picked up by the compiler there. Copying from that folder to /usr/lib resolves the problem. This may not be necessary in all cases.

Notes about dependencies

This repo comes with a copy of the headers for the version of IUP that it was developed against (3.30), but does not ship with the runtime libraries. It is not necessary to get the IM library runtime if you do not plan to use it in your application.

By default VIUP only initializes the subsystems that are imported. For example, importing just viup only initializes the standard dialogs, containers, and components.

If an extension library is loaded (viup.image), the required runtime binaries must be installed or provided along with the build.

Example

This repo comes with a simple application that demos all of the available controls. This app is available in the "examples/gallery". It requires the IM libraries. Once all runtime libraries are in the folder, run the example with v run ..

Using VIUP

One of the strengths of IUP is that is it a very simple library. All controls are instances of &Control and share the same methods, though not all methods are applicable to a Control. Adjusting settings for a control is as simple as calling set_attr or providing the attributes when initializing the Control.

Here's a basic example of initializing a simple window:

viup.
	dialog(viup.scroll(hbox), "title=Control Gallery")   // Create our dialog with "Control Gallery" as the title and a scrollable Control
	.set_handle("MainWindow")                            // Define a global ID for our Window
	.set_menu("app_menu", menu)                          // Set an app menu if applicable
	.show_xy(viup.Pos.center, viup.Pos.center)           // Display dialog in center of screen

Autofree

VIUP should work with V's autofree, however, there are a few situations that can cause crashes. If a Control is accessed by calling get_focused or get_handle, the resulting variable, once it goes out of scope, will free the control that was restored by those functions. This may crash the application. For now if those methods are used, add [manualfree] to the method and call free() on the Controls within as necessary.

Attributes

All controls can be passed attributes as the last parameters when creating a Control. Any amount of attributes can provided. Attributes can adjust the various characteristics of a Control such as the title, value(s), background or foreground colors, control sub-type, sizing, etc.

Not all available attributes apply to each control. If an invalid attribute is provided it is actually accessible via get_attr but will not affect the control itself. Read up more on attributes in the IUP Documentation.

Example:

viup.list(
	"List",               // control 'name'
	"1=Combo Item 1",     // Attr 1: Slot 1 is 'Combo Item 1'
	"2=Combo Item 2",     // Attr 2: Slot 2 is 'Combo Item 2'
	"3=Combo Item 3",     // ....
	"4=Combo Item 4",     // ....
	"dropdown=yes",       // Attr 5: List is a dropdown
	"expand=horizontal",  // Attr 6: Expand horizontally
	"value=1"             // Attr 7: Set default value to Slot 1
)

Callbacks & Events

All controls have callback methods available for various events. Each callback method starts with on_ and can be quickly chained to add multiple callbacks.

Example:

viup.button("Button", "action").on_action(button_clicked)

fn button_clicked(control &viup.Control) viup.FuncResult {
	viup.message("Button Click", "Button clicked!")
	return .cont
}

In the example above, a Button control is initialized with "Button" for the title. An action callback is added with on_action(button_clicked). button_clicked is an ActionFunc callback and is automatically called when the button is clicked. VIUP mirrors the callbacks that IUP provides pretty closely, typically adding Func on the end for consistency.

The majority of callback functions can return a viup.FuncResult. This result can be one of the following:

  • cont - continue action
  • close - close the application
  • default - perform default action (may be equivalent to cont in most cases)
  • ignore - ignores event and may stop propagation

Chaining

Most Control methods will return back the Control when finished. This makes it easy to chain several method calls together.

Example:

viup
	.message_dialog(
		"title=About",
		"value=$about",
		"dialogtype=information"
	)                                            // Create a message dialog with attributes "title", "value", and "dialogtype"
	.popup(viup.Pos.current, viup.Pos.current)   // Popup dialog to user
	.destroy()                                   // Destroy dialog when closed

Example 2:

viup
	.button("Set font...", "", "expand=horizontal") // Create button with "Set font..." as title
	.set_handle("font_btn")                         // Set a handle name
	.on_action(font_button_clicked) // Set a Action callback

Note: Dialogs return back an struct of Dialog. This struct has a few unique functions associated with it (i.e. popup, show, show_xy). It's not to chain to these methods from regular Control methods.

Controls

All dialog, layouts and elements are "Controls" in IUP. As such, they all share common methods that can be utilized by any Control.

Most used component methods:

Method Description
get_attr / set_attr Get or set an attribute value on the control.
set_attrs Used to set multiple attributes in a single call
set_handle Assigns this control a name on the global level. This is typically used in combination with viup.get_handle to restore the control in callbacks or other functions
get_font / set_font Get or set a Font
refresh / refresh_children Trigger a redraw for this component and/or its children

Dialog Controls

Function Description
color_dialog(...attrs) Opens a color picker with optional color palette
dialog(child, attrs) Creates a standard Window or modal dialog
file_dialog(...attrs) Open a file chooser. This can be used to open or save files
font_dialog(...attrs) Opens a font picker
message_dialog(...attrs) Opens a customizable message modal
message(title, message) Shows a generic message box with a standard "OK" button to close

Container Controls

Function Description
background(child, attrs) A simple container element that is designed to have a background color or image
detach_box(child, attrs) Container that is designed to be detachable from the parent container when needed. Can also be reattached.
fill(...attrs) Fills the remaining space for the parent container
flat_frame(child, attrs) Standard frame that allows custom rendering
flat_scroll(child, attrs) Standard scroll that allows custom rendering
frame(child, attrs) Container that puts a border around its children with an optional title
grid(children, attrs) Multi-control container that lays out its children in a table-like design
hbox(children, attrs) Multi-control container that lays out its children in a row
menu(children, attrs) Multi-control container for a dialog's menu items
radio_group(child, attrs) Container is used to group toggles together into a radio button group
tabs(children, attrs) Multi-control container for tabbed content
vbox(children, attrs) Multi-control container that lays out its children in a column

Standard Controls

Function Description
animated_label(animation, attrs) Creates a control that can display an animation
button(title, action, attrs) Creates a standard button with title for the text
canvas(action, attrs) A control that can be used to render custom content
divider(...attrs) Draws a horizontal or vertical line (horizontal by default)
label(title, attrs) A simple control to show text or images
link(url, title, attrs) Similar to a label, can be used to link to an external source
list(action, attrs) Creates a component that can be used to list multiple values
menu_item(action, attrs) Used in the menu component as a specific action (e.g. "Open File..." or "About")
menu_sep(...attrs) Create a simple horizontal line in a menu
multiline(action, attrs) Creates a multiline chooser component
progress(...attrs) Basic progressbar component
slider(orientation, attrs) Creates a number-line slider component
sub_menu(title, child, attrs) Creates a sub menu component. Sub-menues are children of menu components. Typically structured like: Menu -> Sub-menu -> Menu -> Menu Item.
text(action, attrs) Creates a standard text-input control. Can be set as multi-line, number input, etc.
toggle(title, action, attrs) A radio or checkbox component. Defaults to radio when in a radio_group.

Contributing / Support

This project was developed as a way of improving my understanding of V & C. I will not be providing active support for the project, but I'll happily accept any pull requests. Use at your own discretion!

viup's People

Contributors

kjlaw89 avatar klawrence-fs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

viup's Issues

The example of gallery can't be compiled successfully by vlang0.2.4

C:/V/vlib/viup/attributes.v:89:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
87 | C.IupSetStrAttribute(control, name.to_upper().trim_space().str, value.trim_space().str)
88 |
89 | return control
| ~~~~~~~
90 | }
91 |
C:/V/vlib/viup/attributes.v:104:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
102 | }
103 |
104 | return control
| ~~~~~~~
105 | }
106 |
C:/V/vlib/viup/attributes.v:112:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
110 | C.IupSetAttribute(control, '${name}_data'.to_upper().trim_space().str, charptr(data))
111 |
112 | return control
| ~~~~~~~
113 | }
114 |
C:/V/vlib/viup/attributes.v:118:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
116 | pub fn (control &Control) unset_attr(name string) &Control {
117 | C.IupSetAttribute(control, name.to_upper().trim_space().str, C.NULL)
118 | return control
| ~~~~~~~
119 | }
C:/V/vlib/viup/callbacks.v:134:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
132 | // on_action is triggered when the primary function of the element is performed (e.g. clicking a button)
133 | pub fn (control &Control) on_action(func ActionFunc) &Control {
134 | C.IupSetCallback(control, 'ACTION', func)
| ~~~~~~~~
135 | return control
136 | }
C:/V/vlib/viup/callbacks.v:135:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
133 | pub fn (control &Control) on_action(func ActionFunc) &Control {
134 | C.IupSetCallback(control, 'ACTION', func)
135 | return control
| ~~~~~~~
136 | }
137 |
C:/V/vlib/viup/callbacks.v:139:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
137 |
138 | pub fn (control &Control) on_branch_open(func BranchOpenFunc) &Control {
139 | C.IupSetCallback(control, 'BRANCHOPEN_CB', func)
| ~~~~~~~~~~~~~~~
140 | return control
141 | }
C:/V/vlib/viup/callbacks.v:140:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
138 | pub fn (control &Control) on_branch_open(func BranchOpenFunc) &Control {
139 | C.IupSetCallback(control, 'BRANCHOPEN_CB', func)
140 | return control
| ~~~~~~~
141 | }
142 |
C:/V/vlib/viup/callbacks.v:144:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
142 |
143 | pub fn (control &Control) on_branch_close(func BranchCloseFunc) &Control {
144 | C.IupSetCallback(control, 'BRANCHCLOSE_CB', func)
| ~~~~~~~~~~~~~~~~
145 | return control
146 | }
C:/V/vlib/viup/callbacks.v:145:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
143 | pub fn (control &Control) on_branch_close(func BranchCloseFunc) &Control {
144 | C.IupSetCallback(control, 'BRANCHCLOSE_CB', func)
145 | return control
| ~~~~~~~
146 | }
147 |
C:/V/vlib/viup/callbacks.v:150:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
148 | // on_button occurs when a button is clicked
149 | pub fn (control &Control) on_button(func ButtonFunc) &Control {
150 | C.IupSetCallback(control, 'BUTTON_CB', func)
| ~~~~~~~~~~~
151 | return control
152 | }
C:/V/vlib/viup/callbacks.v:151:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
149 | pub fn (control &Control) on_button(func ButtonFunc) &Control {
150 | C.IupSetCallback(control, 'BUTTON_CB', func)
151 | return control
| ~~~~~~~
152 | }
153 |
C:/V/vlib/viup/callbacks.v:156:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
154 | // on_button_press occurs when a button is pressed, but not released
155 | pub fn (control &Control) on_button_press(func ButtonPressFunc) &Control {
156 | C.IupSetCallback(control, 'BUTTON_PRESS_CB', func)
| ~~~~~~~~~~~~~~~~~
157 | return control
158 | }
C:/V/vlib/viup/callbacks.v:157:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
155 | pub fn (control &Control) on_button_press(func ButtonPressFunc) &Control {
156 | C.IupSetCallback(control, 'BUTTON_PRESS_CB', func)
157 | return control
| ~~~~~~~
158 | }
159 |
C:/V/vlib/viup/callbacks.v:162:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
160 | // on_button_release occurs when a button is pressed and then released
161 | pub fn (control &Control) on_button_release(func ButtonReleaseFunc) &Control {
162 | C.IupSetCallback(control, 'BUTTON_RELEASE_CB', func)
| ~~~~~~~~~~~~~~~~~~~
163 | return control
164 | }
C:/V/vlib/viup/callbacks.v:163:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
161 | pub fn (control &Control) on_button_release(func ButtonReleaseFunc) &Control {
162 | C.IupSetCallback(control, 'BUTTON_RELEASE_CB', func)
163 | return control
| ~~~~~~~
164 | }
165 |
C:/V/vlib/viup/callbacks.v:167:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
165 |
166 | pub fn (control &Control) on_caret(func CaretFunc) &Control {
167 | C.IupSetCallback(control, 'CARET_CB', func)
| ~~~~~~~~~~
168 | return control
169 | }
C:/V/vlib/viup/callbacks.v:168:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
166 | pub fn (control &Control) on_caret(func CaretFunc) &Control {
167 | C.IupSetCallback(control, 'CARET_CB', func)
168 | return control
| ~~~~~~~
169 | }
170 |
C:/V/vlib/viup/callbacks.v:172:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
170 |
171 | pub fn (control &Control) on_cell(func CellFunc) &Control {
172 | C.IupSetCallback(control, 'CELL_CB', func)
| ~~~~~~~~~
173 | return control
174 | }
C:/V/vlib/viup/callbacks.v:173:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
171 | pub fn (control &Control) on_cell(func CellFunc) &Control {
172 | C.IupSetCallback(control, 'CELL_CB', func)
173 | return control
| ~~~~~~~
174 | }
175 |
C:/V/vlib/viup/callbacks.v:178:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
176 | // on_change occurs when the value in an input is changed
177 | pub fn (control &Control) on_change(func ChangeFunc) &Control {
178 | C.IupSetCallback(control, 'CHANGE_CB', func)
| ~~~~~~~~~~~
179 | return control
180 | }
C:/V/vlib/viup/callbacks.v:179:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
177 | pub fn (control &Control) on_change(func ChangeFunc) &Control {
178 | C.IupSetCallback(control, 'CHANGE_CB', func)
179 | return control
| ~~~~~~~
180 | }
181 |
C:/V/vlib/viup/callbacks.v:184:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
182 | // on_dbl_click occurs when an element is double-clicked
183 | pub fn (control &Control) on_dbl_click(func DblClickFunc) &Control {
184 | C.IupSetCallback(control, 'DBLCLICK_CB', func)
| ~~~~~~~~~~~~~
185 | return control
186 | }
C:/V/vlib/viup/callbacks.v:185:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
183 | pub fn (control &Control) on_dbl_click(func DblClickFunc) &Control {
184 | C.IupSetCallback(control, 'DBLCLICK_CB', func)
185 | return control
| ~~~~~~~
186 | }
187 |
C:/V/vlib/viup/callbacks.v:190:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
188 | // on_destroy occurs when an element is freed
189 | pub fn (control &Control) on_destroy(func DestroyFunc) &Control {
190 | C.IupSetCallback(control, 'DESTROY_CB', func)
| ~~~~~~~~~~~~
191 | return control
192 | }
C:/V/vlib/viup/callbacks.v:191:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
189 | pub fn (control &Control) on_destroy(func DestroyFunc) &Control {
190 | C.IupSetCallback(control, 'DESTROY_CB', func)
191 | return control
| ~~~~~~~
192 | }
193 |
C:/V/vlib/viup/callbacks.v:195:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
193 |
194 | pub fn (control &Control) on_detached(func DetachedFunc) &Control {
195 | C.IupSetCallback(control, 'DETACHED_CB', func)
| ~~~~~~~~~~~~~
196 | return control
197 | }
C:/V/vlib/viup/callbacks.v:196:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
194 | pub fn (control &Control) on_detached(func DetachedFunc) &Control {
195 | C.IupSetCallback(control, 'DETACHED_CB', func)
196 | return control
| ~~~~~~~
197 | }
198 |
C:/V/vlib/viup/callbacks.v:201:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
199 | // on_drag occurs when an element is being dragged
200 | pub fn (control &Control) on_drag(func DragFunc) &Control {
201 | C.IupSetCallback(control, 'DRAG_CB', func)
| ~~~~~~~~~
202 | return control
203 | }
C:/V/vlib/viup/callbacks.v:202:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
200 | pub fn (control &Control) on_drag(func DragFunc) &Control {
201 | C.IupSetCallback(control, 'DRAG_CB', func)
202 | return control
| ~~~~~~~
203 | }
204 |
C:/V/vlib/viup/callbacks.v:207:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
205 | // on_drag_drop occurs when an element is dragged and then dropped
206 | pub fn (control &Control) on_drag_drop(func DragDropFunc) &Control {
207 | C.IupSetCallback(control, 'DRAGDROP_CB', func)
| ~~~~~~~~~~~~~
208 | return control
209 | }
C:/V/vlib/viup/callbacks.v:208:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
206 | pub fn (control &Control) on_drag_drop(func DragDropFunc) &Control {
207 | C.IupSetCallback(control, 'DRAGDROP_CB', func)
208 | return control
| ~~~~~~~
209 | }
210 |
C:/V/vlib/viup/callbacks.v:213:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
211 | // on_draw occurs when an element needs to be redrawn (applies to Canvas elements)
212 | pub fn (control &Control) on_draw(func DrawFunc) &Control {
213 | C.IupSetCallback(control, 'ACTION', func)
| ~~~~~~~~
214 | return control
215 | }
C:/V/vlib/viup/callbacks.v:214:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
212 | pub fn (control &Control) on_draw(func DrawFunc) &Control {
213 | C.IupSetCallback(control, 'ACTION', func)
214 | return control
| ~~~~~~~
215 | }
216 |
C:/V/vlib/viup/callbacks.v:218:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
216 |
217 | pub fn (control &Control) on_drop_down(func DropDownFunc) &Control {
218 | C.IupSetCallback(control, 'DROPDOWN_CB', func)
| ~~~~~~~~~~~~~
219 | return control
220 | }
C:/V/vlib/viup/callbacks.v:219:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
217 | pub fn (control &Control) on_drop_down(func DropDownFunc) &Control {
218 | C.IupSetCallback(control, 'DROPDOWN_CB', func)
219 | return control
| ~~~~~~~
220 | }
221 |
C:/V/vlib/viup/callbacks.v:223:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
221 |
222 | pub fn (control &Control) on_drop_files(func DropFilesFunc) &Control {
223 | C.IupSetCallback(control, 'DROPFILES_CB', func)
| ~~~~~~~~~~~~~~
224 | return control
225 | }
C:/V/vlib/viup/callbacks.v:224:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
222 | pub fn (control &Control) on_drop_files(func DropFilesFunc) &Control {
223 | C.IupSetCallback(control, 'DROPFILES_CB', func)
224 | return control
| ~~~~~~~
225 | }
226 |
C:/V/vlib/viup/callbacks.v:229:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
227 | // on_edit occurs when an element is being edited
228 | pub fn (control &Control) on_edit(func EditFunc) &Control {
229 | C.IupSetCallback(control, 'EDIT_CB', func)
| ~~~~~~~~~
230 | return control
231 | }
C:/V/vlib/viup/callbacks.v:230:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
228 | pub fn (control &Control) on_edit(func EditFunc) &Control {
229 | C.IupSetCallback(control, 'EDIT_CB', func)
230 | return control
| ~~~~~~~
231 | }
232 |
C:/V/vlib/viup/callbacks.v:234:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
232 |
233 | pub fn (control &Control) on_entered(func EnteredFunc) &Control {
234 | C.IupSetCallback(control, 'ENTERWINDOW_CB', func)
| ~~~~~~~~~~~~~~~~
235 | return control
236 | }
C:/V/vlib/viup/callbacks.v:235:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
233 | pub fn (control &Control) on_entered(func EnteredFunc) &Control {
234 | C.IupSetCallback(control, 'ENTERWINDOW_CB', func)
235 | return control
| ~~~~~~~
236 | }
237 |
C:/V/vlib/viup/callbacks.v:239:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
237 |
238 | pub fn (control &Control) on_execute_branch(func ExecuteBranchFunc) &Control {
239 | C.IupSetCallback(control, 'EXECUTEBRANCH_CB', func)
| ~~~~~~~~~~~~~~~~~~
240 | return control
241 | }
C:/V/vlib/viup/callbacks.v:240:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
238 | pub fn (control &Control) on_execute_branch(func ExecuteBranchFunc) &Control {
239 | C.IupSetCallback(control, 'EXECUTEBRANCH_CB', func)
240 | return control
| ~~~~~~~
241 | }
242 |
C:/V/vlib/viup/callbacks.v:244:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
242 |
243 | pub fn (control &Control) on_execute_left(func ExecuteLeafFunc) &Control {
244 | C.IupSetCallback(control, 'EXECUTELEAF_CB', func)
| ~~~~~~~~~~~~~~~~
245 | return control
246 | }
C:/V/vlib/viup/callbacks.v:245:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
243 | pub fn (control &Control) on_execute_left(func ExecuteLeafFunc) &Control {
244 | C.IupSetCallback(control, 'EXECUTELEAF_CB', func)
245 | return control
| ~~~~~~~
246 | }
247 |
C:/V/vlib/viup/callbacks.v:249:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
247 |
248 | pub fn (control &Control) on_exited(func ExitedFunc) &Control {
249 | C.IupSetCallback(control, 'LEAVEWINDOW_CB', func)
| ~~~~~~~~~~~~~~~~
250 | return control
251 | }
C:/V/vlib/viup/callbacks.v:250:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
248 | pub fn (control &Control) on_exited(func ExitedFunc) &Control {
249 | C.IupSetCallback(control, 'LEAVEWINDOW_CB', func)
250 | return control
| ~~~~~~~
251 | }
252 |
C:/V/vlib/viup/callbacks.v:254:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
252 |
253 | pub fn (control &Control) on_extended(func ExtendedFunc) &Control {
254 | C.IupSetCallback(control, 'EXTENDED_CB', func)
| ~~~~~~~~~~~~~
255 | return control
256 | }
C:/V/vlib/viup/callbacks.v:255:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
253 | pub fn (control &Control) on_extended(func ExtendedFunc) &Control {
254 | C.IupSetCallback(control, 'EXTENDED_CB', func)
255 | return control
| ~~~~~~~
256 | }
257 |
C:/V/vlib/viup/callbacks.v:259:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
257 |
258 | pub fn (control &Control) on_extra_button(func ExtraButtonFunc) &Control {
259 | C.IupSetCallback(control, 'EXTRABUTTON_CB', func)
| ~~~~~~~~~~~~~~~~
260 | return control
261 | }
C:/V/vlib/viup/callbacks.v:260:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
258 | pub fn (control &Control) on_extra_button(func ExtraButtonFunc) &Control {
259 | C.IupSetCallback(control, 'EXTRABUTTON_CB', func)
260 | return control
| ~~~~~~~
261 | }
262 |
C:/V/vlib/viup/callbacks.v:264:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
262 |
263 | pub fn (control &Control) on_flat_action(func FlatActionFunc) &Control {
264 | C.IupSetCallback(control, 'FLAT_ACTION', func)
| ~~~~~~~~~~~~~
265 | return control
266 | }
C:/V/vlib/viup/callbacks.v:265:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
263 | pub fn (control &Control) on_flat_action(func FlatActionFunc) &Control {
264 | C.IupSetCallback(control, 'FLAT_ACTION', func)
265 | return control
| ~~~~~~~
266 | }
267 |
C:/V/vlib/viup/callbacks.v:270:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
268 | // on_focused occurs when an element receives focus
269 | pub fn (control &Control) on_focused(func FocusedFunc) &Control {
270 | C.IupSetCallback(control, 'GETFOCUS_CB', func)
| ~~~~~~~~~~~~~
271 | return control
272 | }
C:/V/vlib/viup/callbacks.v:271:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
269 | pub fn (control &Control) on_focused(func FocusedFunc) &Control {
270 | C.IupSetCallback(control, 'GETFOCUS_CB', func)
271 | return control
| ~~~~~~~
272 | }
273 |
C:/V/vlib/viup/callbacks.v:276:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
274 | // on_help occurs when the focused element has the "help" method called on it
275 | pub fn (control &Control) on_help(func HelpFunc) &Control {
276 | C.IupSetCallback(control, 'HELP_CB', func)
| ~~~~~~~~~
277 | return control
278 | }
C:/V/vlib/viup/callbacks.v:277:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
275 | pub fn (control &Control) on_help(func HelpFunc) &Control {
276 | C.IupSetCallback(control, 'HELP_CB', func)
277 | return control
| ~~~~~~~
278 | }
279 |
C:/V/vlib/viup/callbacks.v:282:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
280 | // on_key occurs when any key is pressed down
281 | pub fn (control &Control) on_key(func KeyFunc) &Control {
282 | C.IupSetCallback(control, 'K_ANY', func)
| ~~~~~~~
283 | return control
284 | }
C:/V/vlib/viup/callbacks.v:283:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
281 | pub fn (control &Control) on_key(func KeyFunc) &Control {
282 | C.IupSetCallback(control, 'K_ANY', func)
283 | return control
| ~~~~~~~
284 | }
285 |
C:/V/vlib/viup/callbacks.v:288:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
286 | // on_key_press occurs when a key is fully pressed and released
287 | pub fn (control &Control) on_key_press(func KeyPressFunc) &Control {
288 | C.IupSetCallback(control, 'KEYPRESS_CB', func)
| ~~~~~~~~~~~~~
289 | return control
290 | }
C:/V/vlib/viup/callbacks.v:289:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
287 | pub fn (control &Control) on_key_press(func KeyPressFunc) &Control {
288 | C.IupSetCallback(control, 'KEYPRESS_CB', func)
289 | return control
| ~~~~~~~
290 | }
291 |
C:/V/vlib/viup/callbacks.v:293:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
291 |
292 | pub fn (control &Control) on_map(func MapFunc) &Control {
293 | C.IupSetCallback(control, 'MAP_CB', func)
| ~~~~~~~~
294 | return control
295 | }
C:/V/vlib/viup/callbacks.v:294:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
292 | pub fn (control &Control) on_map(func MapFunc) &Control {
293 | C.IupSetCallback(control, 'MAP_CB', func)
294 | return control
| ~~~~~~~
295 | }
296 |
C:/V/vlib/viup/callbacks.v:298:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
296 |
297 | pub fn (control &Control) on_motion(func MotionFunc) &Control {
298 | C.IupSetCallback(control, 'MOTION_CB', func)
| ~~~~~~~~~~~
299 | return control
300 | }
C:/V/vlib/viup/callbacks.v:299:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
297 | pub fn (control &Control) on_motion(func MotionFunc) &Control {
298 | C.IupSetCallback(control, 'MOTION_CB', func)
299 | return control
| ~~~~~~~
300 | }
301 |
C:/V/vlib/viup/callbacks.v:304:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
302 | // on_mouse_button occurs when any mouse button is pressed
303 | pub fn (control &Control) on_mouse_button(func MouseButtonFunc) &Control {
304 | C.IupSetCallback(control, 'BUTTON_CB', func)
| ~~~~~~~~~~~
305 | return control
306 | }
C:/V/vlib/viup/callbacks.v:305:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
303 | pub fn (control &Control) on_mouse_button(func MouseButtonFunc) &Control {
304 | C.IupSetCallback(control, 'BUTTON_CB', func)
305 | return control
| ~~~~~~~
306 | }
307 |
C:/V/vlib/viup/callbacks.v:310:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
308 | // on_mouse_move occurs whenever mouse movement has happened
309 | pub fn (control &Control) on_mouse_move(func MouseMoveFunc) &Control {
310 | C.IupSetCallback(control, 'MOUSEMOVE_CB', func)
| ~~~~~~~~~~~~~~
311 | return control
312 | }
C:/V/vlib/viup/callbacks.v:311:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
309 | pub fn (control &Control) on_mouse_move(func MouseMoveFunc) &Control {
310 | C.IupSetCallback(control, 'MOUSEMOVE_CB', func)
311 | return control
| ~~~~~~~
312 | }
313 |
C:/V/vlib/viup/callbacks.v:315:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
313 |
314 | pub fn (control &Control) on_multiselect(func MultiSelectFunc) &Control {
315 | C.IupSetCallback(control, 'MULTISELECT_CB', func)
| ~~~~~~~~~~~~~~~~
316 | return control
317 | }
C:/V/vlib/viup/callbacks.v:316:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
314 | pub fn (control &Control) on_multiselect(func MultiSelectFunc) &Control {
315 | C.IupSetCallback(control, 'MULTISELECT_CB', func)
316 | return control
| ~~~~~~~
317 | }
318 |
C:/V/vlib/viup/callbacks.v:320:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
318 |
319 | pub fn (control &Control) on_multiselection(func MultiSelectionFunc) &Control {
320 | C.IupSetCallback(control, 'MULTISELECTION_CB', func)
| ~~~~~~~~~~~~~~~~~~~
321 | return control
322 | }
C:/V/vlib/viup/callbacks.v:321:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
319 | pub fn (control &Control) on_multiselection(func MultiSelectionFunc) &Control {
320 | C.IupSetCallback(control, 'MULTISELECTION_CB', func)
321 | return control
| ~~~~~~~
322 | }
323 |
C:/V/vlib/viup/callbacks.v:325:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
323 |
324 | pub fn (control &Control) on_multiunselect(func MultiUnselectionFunc) &Control {
325 | C.IupSetCallback(control, 'MULTIUNSELECTION_CB', func)
| ~~~~~~~~~~~~~~~~~~~~~
326 | return control
327 | }
C:/V/vlib/viup/callbacks.v:326:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
324 | pub fn (control &Control) on_multiunselect(func MultiUnselectionFunc) &Control {
325 | C.IupSetCallback(control, 'MULTIUNSELECTION_CB', func)
326 | return control
| ~~~~~~~
327 | }
328 |
C:/V/vlib/viup/callbacks.v:330:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
328 |
329 | pub fn (control &Control) on_node_removed(func NodeRemovedFunc) &Control {
330 | C.IupSetCallback(control, 'NODEREMOVED_CB', func)
| ~~~~~~~~~~~~~~~~
331 | return control
332 | }
C:/V/vlib/viup/callbacks.v:331:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
329 | pub fn (control &Control) on_node_removed(func NodeRemovedFunc) &Control {
330 | C.IupSetCallback(control, 'NODEREMOVED_CB', func)
331 | return control
| ~~~~~~~
332 | }
333 |
C:/V/vlib/viup/callbacks.v:335:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
333 |
334 | pub fn (control &Control) on_open_close(func OpenCloseFunc) &Control {
335 | C.IupSetCallback(control, 'OPENCLOSE_CB', func)
| ~~~~~~~~~~~~~~
336 | return control
337 | }
C:/V/vlib/viup/callbacks.v:336:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
334 | pub fn (control &Control) on_open_close(func OpenCloseFunc) &Control {
335 | C.IupSetCallback(control, 'OPENCLOSE_CB', func)
336 | return control
| ~~~~~~~
337 | }
338 |
C:/V/vlib/viup/callbacks.v:340:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
338 |
339 | pub fn (control &Control) on_rename(func RenameFunc) &Control {
340 | C.IupSetCallback(control, 'RENAME_CB', func)
| ~~~~~~~~~~~
341 | return control
342 | }
C:/V/vlib/viup/callbacks.v:341:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
339 | pub fn (control &Control) on_rename(func RenameFunc) &Control {
340 | C.IupSetCallback(control, 'RENAME_CB', func)
341 | return control
| ~~~~~~~
342 | }
343 |
C:/V/vlib/viup/callbacks.v:346:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
344 | // on_resize occurs whenever an element is resized
345 | pub fn (control &Control) on_resize(func ResizeFunc) &Control {
346 | C.IupSetCallback(control, 'RESIZE_CB', func)
| ~~~~~~~~~~~
347 | return control
348 | }
C:/V/vlib/viup/callbacks.v:347:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
345 | pub fn (control &Control) on_resize(func ResizeFunc) &Control {
346 | C.IupSetCallback(control, 'RESIZE_CB', func)
347 | return control
| ~~~~~~~
348 | }
349 |
C:/V/vlib/viup/callbacks.v:352:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
350 | // on_right_click occurs whenever a right-click even is detected
351 | pub fn (control &Control) on_right_click(func RightClickFunc) &Control {
352 | C.IupSetCallback(control, 'RIGHTCLICK_CB', func)
| ~~~~~~~~~~~~~~~
353 | return control
354 | }
C:/V/vlib/viup/callbacks.v:353:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
351 | pub fn (control &Control) on_right_click(func RightClickFunc) &Control {
352 | C.IupSetCallback(control, 'RIGHTCLICK_CB', func)
353 | return control
| ~~~~~~~
354 | }
355 |
C:/V/vlib/viup/callbacks.v:357:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
355 |
356 | pub fn (control &Control) on_restored(func RestoredFunc) &Control {
357 | C.IupSetCallback(control, 'RESTORED_CB', func)
| ~~~~~~~~~~~~~
358 | return control
359 | }
C:/V/vlib/viup/callbacks.v:358:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
356 | pub fn (control &Control) on_restored(func RestoredFunc) &Control {
357 | C.IupSetCallback(control, 'RESTORED_CB', func)
358 | return control
| ~~~~~~~
359 | }
360 |
C:/V/vlib/viup/callbacks.v:363:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
361 | // on_select occurs whenever a value is selected in an element
362 | pub fn (control &Control) on_select(func SelectFunc) &Control {
363 | C.IupSetCallback(control, 'SELECT_CB', func)
| ~~~~~~~~~~~
364 | return control
365 | }
C:/V/vlib/viup/callbacks.v:364:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
362 | pub fn (control &Control) on_select(func SelectFunc) &Control {
363 | C.IupSetCallback(control, 'SELECT_CB', func)
364 | return control
| ~~~~~~~
365 | }
366 |
C:/V/vlib/viup/callbacks.v:368:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
366 |
367 | pub fn (control &Control) on_selection(func SelectionFunc) &Control {
368 | C.IupSetCallback(control, 'SELECTION_CB', func)
| ~~~~~~~~~~~~~~
369 | return control
370 | }
C:/V/vlib/viup/callbacks.v:369:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
367 | pub fn (control &Control) on_selection(func SelectionFunc) &Control {
368 | C.IupSetCallback(control, 'SELECTION_CB', func)
369 | return control
| ~~~~~~~
370 | }
371 |
C:/V/vlib/viup/callbacks.v:373:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
371 |
372 | pub fn (control &Control) on_scroll(func ScrollFunc) &Control {
373 | C.IupSetCallback(control, 'SCROLL_CB', func)
| ~~~~~~~~~~~
374 | return control
375 | }
C:/V/vlib/viup/callbacks.v:374:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
372 | pub fn (control &Control) on_scroll(func ScrollFunc) &Control {
373 | C.IupSetCallback(control, 'SCROLL_CB', func)
374 | return control
| ~~~~~~~
375 | }
376 |
C:/V/vlib/viup/callbacks.v:378:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
376 |
377 | pub fn (control &Control) on_show_rename(func ShowRenameFunc) &Control {
378 | C.IupSetCallback(control, 'SHOWRENAME_CB', func)
| ~~~~~~~~~~~~~~~
379 | return control
380 | }
C:/V/vlib/viup/callbacks.v:379:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
377 | pub fn (control &Control) on_show_rename(func ShowRenameFunc) &Control {
378 | C.IupSetCallback(control, 'SHOWRENAME_CB', func)
379 | return control
| ~~~~~~~
380 | }
381 |
C:/V/vlib/viup/callbacks.v:383:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
381 |
382 | pub fn (control &Control) on_switch(func SwitchFunc) &Control {
383 | C.IupSetCallback(control, 'SWITCH_CB', func)
| ~~~~~~~~~~~
384 | return control
385 | }
C:/V/vlib/viup/callbacks.v:384:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
382 | pub fn (control &Control) on_switch(func SwitchFunc) &Control {
383 | C.IupSetCallback(control, 'SWITCH_CB', func)
384 | return control
| ~~~~~~~
385 | }
386 |
C:/V/vlib/viup/callbacks.v:389:28: error: cannot use string as charptr in argument 2 to C.IupSetCallback
387 | // on_tab_change occurs when a tab is selected
388 | pub fn (control &Control) on_tab_change(func TabChangeFunc) &Control {
389 | C.IupSetCallback(control, 'TABCHANGE_CB', func)
| ~~~~~~~~~~~~~~
390 | return control
391 | }
C:/V/vlib/viup/callbacks.v:390:9: error: control cannot be returned outside unsafe blocks as it might refer to an object stored on stack. Consider declaring viup.Control as [heap].
388 | pub fn (control &Control) on_tab_change(func TabChangeFunc) &Control {
389 | C.IupSetCallback(control, 'TABCHANGE_CB', func)
390 | return control
| ~~~~~~~
391 | }
392 |

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.