Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper function for sending InSim buttons #51

Open
mkapal opened this issue Aug 2, 2024 · 4 comments
Open

Helper function for sending InSim buttons #51

mkapal opened this issue Aug 2, 2024 · 4 comments
Assignees
Labels

Comments

@mkapal
Copy link
Member

mkapal commented Aug 2, 2024

Problem

  • If you want to create a button with a type-in dialog including a caption, you must send the caption in the Text property delimited by zero-bytes: '\0Caption\0Text'.

Current API

inSim.send(new IS_BTN({
  ReqI: 1,
  L: 60,
  T: 4,
  W: 20,
  H: 5,
  TypeIn: 20,
  Text: '\0Caption\0Text',
}))

Proposed API

inSim.sendButton({
  requestId: 1,
  left: 60,
  top: 4,
  width: 20,
  height: 5,
  text: 'Text',
  typeIn: 20,
  caption: 'Caption',
})
@mkapal mkapal added the proposal label Aug 2, 2024
@mkapal mkapal self-assigned this Aug 2, 2024
@mkapal mkapal changed the title Friendly API abstraction on top of packets User-riendly API abstraction on top of packets Aug 2, 2024
@Degats
Copy link

Degats commented Aug 2, 2024

From experience, it's very useful to have abstractions like these for some specific packets, especially buttons as the Text field has some complex behaviour.

@mkapal mkapal changed the title User-riendly API abstraction on top of packets User-friendly API abstraction on top of packets Aug 2, 2024
@theangryangel
Copy link

Something you may also want to have in the back of your head, at some point in insim.rs I had a send_and_wait_for_response style method where it would automatically set the reqi on a given packet (ensuring it was unique on a per-insim-connection basis), and then wait for a response where the reqi was the same, and then return the packet.

I dropped it, with the plan to bring it back (eventually) - but it is something I've needed at some point in most insim things I've worked on.

@mkapal
Copy link
Member Author

mkapal commented Aug 2, 2024

@theangryangel Thanks, that's a good idea, I will consider it for the future.

@mkapal mkapal changed the title User-friendly API abstraction on top of packets Helper function for sending InSim buttons Nov 26, 2024
@mkapal mkapal added enhancement New feature or request scope:insim InSim and removed proposal labels Nov 26, 2024
@mkapal
Copy link
Member Author

mkapal commented Nov 26, 2024

I've split this issue into two, created a new one for messages: #54

@mkapal mkapal removed the enhancement New feature or request label Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants