hard centering

13 views
Skip to first unread message

Joel Burget

unread,
Feb 8, 2018, 8:43:36 PM2/8/18
to Brick Users
Hi all,

I have a quick question I'd love suggestions on. I'm trying to render a sequence of (machine code) instructions for an interactive debugger I'm writing. The user presses right, it goes to the next instruction / machine state. Left returns to the previous state. I'd love to show instructions across the screen such that the current instruction is always centered. The subtlety that I don't know how to do is centering based only on the current instruction (pushing around the other instructions).

Thanks in advance,
Joel

Jonathan Daugherty

unread,
Feb 8, 2018, 9:37:07 PM2/8/18
to Joel Burget, Brick Users
Hello,

> The subtlety that I don't know how to do is centering based only on
> the current instruction (pushing around the other instructions).

I'm not quite sure what you mean by "pushing around the other
instructions." Would it be possible for you to mock up (in an e-mail,
say) the aspect of the UI you want?

--
Jonathan Daugherty

Joel Burget

unread,
Feb 8, 2018, 9:41:56 PM2/8/18
to Jonathan Daugherty, Brick Users
I tweeted my WIP (https://twitter.com/dino_joel/status/961781595626713088). It's cut off around the edges but hopefully it'll do to illustrate what I'm going for. The blue instruction is the currently executing one and to the left and right you can see previous and next instructions.

Jonathan Daugherty

unread,
Feb 8, 2018, 10:46:44 PM2/8/18
to Joel Burget, Brick Users
> I tweeted my WIP (https://twitter.com/dino_joel/status/961781595626713088).
> It's cut off around the edges but hopefully it'll do to illustrate what I'm
> going for. The blue instruction is the currently executing one and to the
> left and right you can see previous and next instructions.

It's a little tricky and requires writing a custom widget; I've attached
a program that might do what you want.

--
Jonathan Daugherty
LayerDemo.hs

Joel Burget

unread,
Feb 8, 2018, 10:48:07 PM2/8/18
to Jonathan Daugherty, Brick Users
I should also add that the gap between the centered instructions and the other is not intentional. It’s due to the crude heuristic I was using to add the previous and upcoming instructions both of the same width.

Joel Burget

unread,
Feb 8, 2018, 10:51:27 PM2/8/18
to Jonathan Daugherty, Brick Users
That's perfect. Thank you.
Reply all
Reply to author
Forward
0 new messages