GithubHelp home page GithubHelp logo

snowkit / linc_dialogs Goto Github PK

View Code? Open in Web Editor NEW
19.0 8.0 4.0 21 KB

http://snowkit.github.io/linc/ Haxe @:native bindings for Open, Folder, and Save dialogs

License: MIT License

Haxe 27.91% C++ 45.34% Objective-C++ 26.75%

linc_dialogs's Introduction

linc/dialogs

Haxe @:native bindings for Folder, Open and Save dialogs across Windows, Mac and Linux (GTK 3+)

This is a linc library.


This library works with the Haxe cpp target only.


Install

haxelib git linc_dialogs https://github.com/snowkit/linc_dialogs.git

Supported platforms

  • Mac
  • Linux (GTK 3)
  • Windows

Example usage

notes: - some platforms, when there is no Main Window, have focus issues with cli - cancelled or failed dialogs return a blank string, test for it

import dialogs.Dialogs;

class Test {

    static function main() {

      var result =
        Dialogs.open('Load image',
            [
                { ext:'gif', desc:'GIF image' },
                { ext:'png', desc:'PNG image' }
            ]
        );

      trace("Open result: "+result);

      result = Dialogs.save('Save text file',
            { ext:'txt', desc:'Text file' }
      );

      trace("Save result: "+result);

      result = Dialogs.folder('Select a random folder');

      trace("Folder result: "+result);

    }
} 

linc_dialogs's People

Contributors

jcward avatar ruby0x1 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linc_dialogs's Issues

Apps become unresponsive (appear frozen) when a dialog is up

It's understandable that an app would not be interactive while a dialog is up, but the apps I've tested (hxScout, snow basic testcase) become, while the dialog is open, unresponsive is such a way that it produces undesirable results.

On linux, the window becomes gray and dark (like when a runaway process is no longer responding to the OS.) On windows, it's worse such that the app window gets painted over by the dialog.

It's not an absolute blocker, because the app does come back once the dialog is closed. But it does look bad.

snow basic test on linux (note dark app behind dialog):
screenshot from 2015-08-18 19 37 02

hxScout on linux:
screenshot from 2015-08-17 23 53 52

hxScout on windows (especially bad, the dialog graphics are drawn over the hxScout window):
screenshot from 2015-08-17 23 34 32

Unable to compile on mac

haxe 3.4.0
hxcpp 3.4.49
lime 3.7.2
openfl 4.7.3
linc_dialogs up to date with master

OSX El Capitan (10.11.4)
XCode 7.3

Compiler invocation:

haxelib run lime test mac

Output:

Link: ApplicationMain
Undefined symbols for architecture x86_64:
  "linc::dialogs::open(String, Array<Dynamic>)", referenced from:
      ui::InstrumentPanel_obj::onPressOpen() in 0d936921_InstrumentPanel.o
  "linc::dialogs::save(String, Dynamic)", referenced from:
      ui::InstrumentPanel_obj::onPressSaveAs() in 0d936921_InstrumentPanel.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've recently upgraded haxe, hxcpp, lime, basically everything I have at the top of that list to most recent version. Somewhere along the way, linc_dialogs stopped compiling for me on mac. I haven't tried upgrading OSX to Sierra yet because that potentially affects other things for me, but if it's likely to work I'll do it.

Dialogs.open() changes cwd on some platforms

I don't know if this is a bug on OpenFL or on linc_dialogs, but basically:

  1. Open a file with Dialogs.open() (you must actually select a file, not hit "cancel")
  2. Try to load a bitmap data with Assets.getBitmapData

It will always be null.

Here's some repro code, a modified version of OpenFL's DisplayingABitmap demo:

package;


import dialogs.Dialogs;
import lime.app.Application;
import openfl.Assets;
import openfl.display.Bitmap;
import openfl.display.Sprite;
import openfl.system.System;


class Main extends Sprite {

    public function new () {

        super();

        var str = Dialogs.open("title");

        trace("file = " + str);

        var bmpData = Assets.getBitmapData ("assets/openfl.png");

        trace("bmpData = " + bmpData);

        var bitmap = new Bitmap (bmpData);
        addChild (bitmap);

        bitmap.x = (stage.stageWidth - bitmap.width) / 2;
        bitmap.y = (stage.stageHeight - bitmap.height) / 2;

    }


}

If you select "cancel", the image loads. If you select a file (any file) it will not load and the trace will similarly indicate that bmpData is null.

I wouldn't normally expect linc_dialogs to interfere with OpenFL's asset system like this, so that's why I'm not quite sure where the bug originates. I figured I'd start here because if I swap linc_dialogs with systools, the problem goes away.

(also, to be clear the error occurs with the latest versions of Lime & OpenFL, and using the next codebase, not legacy)

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.