[erlang-questions] wxErlang question 4

Joe Armstrong erlang@REDACTED
Tue Jul 11 20:15:26 CEST 2017


Stack trace follows:


test.erl

-module(test).

-compile(export_all).
-include("include/gx.hrl").

test() ->
    gx:start(),
    %% rr(gx).
    F = #frame{id=window, size={400,200}},
    gx:create(F),
    gx:names(),
    gx:config(window, size, {800, 400}),
    gx:ide().




1> test:test().

[<0.67.0> gx_driver]
"/usr/local/Cellar/erlang/20.0/lib/erlang/lib/wx-1.8.1/priv"

[<0.67.0> gx_driver] {handle_info,{wxe_driver,open_file,"enabled"}}

[<0.66.0> gx_srv] {g,<0.66.0>,#Port<0.765>,undefined,<0.68.0>,gx}

[<0.70.0> gx_srv] {g,<0.70.0>,#Port<0.779>,undefined,<0.71.0>,ide}

** exception exit: {{badmatch,undefined},

                    [{gx_ui_filetree,create,3,

                                     [{file,"src/ui/gx_ui_filetree.erl"},

                                      {line,37}]},

                     {gx_ui,create,3,[{file,"src/gx_ui.erl"},{line,44}]},

                     {gx_ui,'-create/3-lc$^0/1-0-',3,

                            [{file,"src/gx_ui.erl"},{line,39}]},

                     {gx_ui_panel,create,3,

                                  [{file,"src/ui/gx_ui_panel.erl"},{line,46}]},

                     {gx_ui,create,3,[{file,"src/gx_ui.erl"},{line,44}]},

                     {gx_ui_tab,create,3,

                                [{file,"src/ui/gx_ui_tab.erl"},{line,35}]},

                     {gx_ui,create,3,[{file,"src/gx_ui.erl"},{line,44}]},

                     {gx_ui,'-create/3-lc$^0/1-0-',3,

                            [{file,"src/gx_ui.erl"},{line,39}]}]}

     in function  gx_wx:batch/2 (src/gx_wx.erl, line 39)

     in call from gx_srv:start/1 (src/gx_srv.erl, line 33)

/Joe

On Tue, Jul 11, 2017 at 7:57 PM, Steve Davis
<steven.charles.davis@REDACTED> wrote:
> You shouldn’t have to, no. I just cloned a new copy from github (and cleared my ERL_LIBS to make sure I wasn’t pulling in anything else) and it all seemed to work for me.
>
> Do you have the stacktrace?
>
>
>> On Jul 11, 2017, at 9:39 AM, Joe Armstrong <erlang@REDACTED> wrote:
>>
>> It didn't work for me - how did you launch this?
>>
>> I did erl -pa ebin in the root directory (gx-master)
>> gx:config works and I see a window
>>
>> but gx:idx() crashes with a badmatch
>> in line 37 of gx_ui_filetree.erl the line saying
>>
>> directory = path:type(Path),
>>
>> I think this is returning undefined -
>>
>> Do I have to set some environment variables or something?
>>
>> ./Joe
>>
>>
>>
>> On Tue, Jul 11, 2017 at 1:22 PM, Steve Davis
>> <steven.charles.davis@REDACTED> wrote:
>>> 1) One of those projects that I haven’t had time for. If there was interest,
>>> it may rekindle my interest in moving it along. Looking back, with the
>>> second prototype I diverged too far from the GS way of doing this as I got
>>> focused on XML definitions and so the interactive REPL part suffered. it’s
>>> really code in mid-flight.
>>>
>>> 2) However, the code still seems to work under R20 - See console session
>>> below:
>>>
>>> Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:4:4] [ds:4:4:10]
>>> [async-threads:10] [hipe] [kernel-poll:false]
>>>
>>> Eshell V9.0  (abort with ^G)
>>> 1> gx:start().
>>> [<0.63.0> gx_driver:150] "/opt/local/lib/erlang/lib/wx-1.8.1/priv"
>>> [<0.63.0> gx_driver:124] info_got_wx_consts
>>> [<0.63.0> gx_driver:134] {handle_info,
>>>                             {wxe_driver,open_file,"/Users/stevedavis"}}
>>> {ok,<0.62.0>}
>>> 2> rr(gx).
>>> [aui,bitmapbutton,box,button,calendar,checkbox,checklist,
>>> choice,combo,control,date,dialog,editor,evh,filetree,font,
>>> frame,g,grid,gs,gs_font,gui,gx,gx_cache,gx_ui,gx_wx,image,
>>> input,line|...]
>>> 3> F = #frame{id=window, size={400,200}}.
>>> #frame{id = window,ref = undefined,label = undefined,
>>>       pos = {-1,-1},
>>>       size = {400,200},
>>>       callbacks = [],icon = undefined,title = <<"Untitled">>,
>>>       show = true,virtual = false,content = []}
>>> 4> gx:create(F).
>>> [#gx_ui{id = window,
>>>        ref = #wx_ref{ref = 37,type = wxFrame,state = []},
>>>        parent = #wx_ref{ref = 0,type = wx,state = []},
>>>        module = gx_ui_frame}]
>>> 5> gx:names().
>>> [window]
>>> 6> gx:config(window, size, {800, 400}).
>>> [<0.60.0> gx_ui:59] {{g,<0.62.0>,#Port<0.3025>,undefined,<0.64.0>,gx},
>>>                     window,
>>>                     [{size,{800,400}}]}
>>> [ok]
>>> 7> gx:ide().
>>> [<0.95.0> gx_ui:59] {{g,<0.93.0>,#Port<0.3158>,undefined,<0.94.0>,ide},
>>>                     log,
>>>                     [{append,<<"$
>>> {init,{gx,ide,{wx_ref,0,wx,[]},gx,start,[],[]},[{resources,undefined}]}\n">>}]}
>>> {ok,<0.93.0>}
>>>
>>>
>>>
>>>
>>> On Jul 11, 2017, at 2:48 AM, Joe Armstrong <erlang@REDACTED> wrote:
>>>
>>> Wow - lot's of code for me to stare at - thanks
>>>
>>> A couple of questions:
>>>
>>> 1) I downloaded the gx project and saw that there had been no
>>>   commits since Jul 13 2014 - is this totally dead?
>>>
>>> 2) How do I run your gx code? - what's a top level command to create a
>>> window???
>>>
>>> Cheers
>>>
>>> /Joe
>>>
>>>
>>> On Tue, Jul 11, 2017 at 1:07 AM, Steve Davis
>>> <steven.charles.davis@REDACTED> wrote:
>>>
>>> Sizers are crazy. A while back I had a decent go at making a hand-written
>>> version of wx interfacing directly to the erlang driver and trying to make
>>> it sensible as an API like GS. I think it should still work.
>>>
>>> The following code was the result of a lot of reading the WxWidgets C++ API
>>> docs and translating into what I felt was sensible to get to a single
>>> interface module that resembled GS (i.e the module gx.erl).
>>>
>>> https://github.com/komone/gx/blob/master/src/ui/gx_ui_sizer.erl
>>>
>>> https://github.com/komone/gx/blob/master/src/ui/gx_ui_control.erl
>>>
>>> https://github.com/komone/gx/blob/master/src/ui/gx_ui_button.erl
>>>
>>>
>>>
>



More information about the erlang-questions mailing list