Maybe you have forgotten the binding, but I am using wxnim from [PMunch 
fork](https://github.com/PMunch/wxnim) from you, 
[Araq](https://github.com/Araq/wxnim), it is not my wrapping code. And the 
example2 is in the wxnim too.
    
    
    nim cpp -r  -d:useSysAssert -d:useGcAssert   example2.nim
    
    
    Run

says 
    
    
    Traceback (most recent call last)
    example2.nim(7)          example2
    example2.nim(40)         createFrame
    SIGSEGV: Illegal storage access. (Attempt to read from nil?)
    
    
    Run

where 
    
    
    line 07       let f = createFrame()
    line 40       text.styleSetForeground(wxSTC_STYLE_LINENUMBER, 
constructWxColour(75, 75, 75) )
    line 41       text.styleSetBackground(wxSTC_STYLE_LINENUMBER, 
constructWxColour(220, 220, 220))
    
    
    Run

if I comment out line 40 and 41, then the compiled EXE can run without crash. I 
am puzzled why line 7 can passed this time

If I change line 40, 41 to 
    
    
    line 40  var c1 = cnew constructWxColour(75, 75, 75)
    line 41  text.styleSetForeground(wxSTC_STYLE_LINENUMBER, c1 )
    line 42  var c2 = cnew constructWxColour(220, 220, 220)
    line 43  text.styleSetBackground(wxSTC_STYLE_LINENUMBER, c2)
    
    
    Run

then I get 
    
    
    example2.nim(41, 7) Error: type mismatch: got <ptr WxStyledTextCtrl, int 
literal(33), ptr WxColour>
    but expected one of:
    proc styleSetForeground(this: var WxStyledTextCtrl; style: cint; fore: 
WxColour)
      first type mismatch at position: 3
      required type: WxColour
      but expression 'c1' is of type: ptr WxColour
    1 other mismatching symbols have been  suppressed; compile with 
--showAllMismatches:on to see them
    
    expression: styleSetForeground(text, 33, c1)
    
    
    
    Run

I still don't know how to fix it 

Reply via email to