Skip to content

How to draw images on collectionView elements (rects) ? #500

@sgmihai

Description

@sgmihai

I am trying to build a very basic gui mockup for my project, and I need a grid of images displayed (prefferably auto resizing to fit the collectionView, which should auto resize with the main window).
I tried modifying the https://github.com/yglukhov/nimx/blob/master/test/sample07_collections.nim code with what I found in https://github.com/yglukhov/nimx/blob/master/test/sample03_image.nim
but no success. Code I tried is here: https://play.nim-lang.org/#ix=480e
Basically I put

let c = currentContext()
c.drawImage(v.posters[i],result.frame)

in the last line of collectionView.viewForItem
I am not sure if it's the proper place or way to do this, in this context.
Result is this: https://i.imgur.com/eGEFGi4.png

I have no experience whatsoever with guis, and already spent half a day trying to figure it out, and another full day researching alternatives. In the end I think nimx is the shortest path to my goal. If only it had more complete and comprehensive docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions