Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.

I've been trying to get the DCS gui lib to work, and windows, buttons and text all work fine. However, when I try to use a checkbox, I can't read if it's checked or not. How do I do this?

also: when I add a new big window to the stack, do I need to pop the previous window off the stack together with all what was in it or does DCS do that automatically?
Good questions, and I'm glad you've been successful with the GUI API so far. The GUI Stack is maintained in RAM separately from your program, so when you call PushGUIStack, data is copied from your program into the GUIStack. After you call GUIMouse, you need to look inside the GUIStack in order to check the values of checkboxes, radiobuttons, text input fields, etc. There are three functions to help you do this:

:: GUIFindFirst
:: GUIFindNext
:: GUIFindThis

If you just want to find one thing, just use GUIFindThis. If you want to look for a bunch of things, use GUIFindFirst (or GUIFindThis) followed by a few GUIFindNext calls. This section of the SDK also discusses this particular trick. Be aware that you'll need to skip three bytes (type, size low, size high) to get to the actual data in each case.

Your second question: Doors CS's stack can maintain lots of large windows at once (or large and small windows), layered on top of each other. You can leave them layered, popping only when you want to remove the stuff on top. If you want to replace a large window with another one, you should pop the first one before you put the new one on the stack.
If I pop a window off the stack, does that also pop the content of the window off the stack or will that be moved to the next or previous window in the stack?
ben_g wrote:
If I pop a window off the stack, does that also pop the content of the window off the stack or will that be moved to the next or previous window in the stack?
If you pushed a window followed by 5 different items onto the stack, you need to pop 6 items off the stack. Each thing you push with PushGUIStack must be popped with PopGUIStack (or PopGUIStacks, to do it all at once).
I still can't get this to work.
The checkbox is the third item that is pushed on the stack (window included). I call GUIFindThis with a = 2 (I also tried it with 1). I skip 3 bytes to get to the data, then 3 more bytes to get the status of the checkbox. That still never seems to be 1.

This program also moves 2 pixels in the icon when the checkbox was selected, but none when it wasn't selected. What am I doing wrong?
Well, remember from the GUIFindThis page that:

Skip These Many to get to:
-- GUI GroupMaster (null/smallwindow/largewindow - can't get to it)
0 First contents
1 Second contents
2 Third contents

If you want to get the third thing pushed (including the LargeWindow as one of the pushed things) you need a=1, not a=2.
checkboxes now work, but when I use GUIByteInt with the lower limit 0 and the upper limit 199, and it reaches 99 and I click the up arrow, it resets to 0

a limit of 99 and a limit of 9 works normally.
I just double-checked my code, and that definitely should not be the case. You're using the proper .dbs, not .dws, right?
this is my code for a number up to 199

  .db 1, 1
  .db 0
  .db 0
  .db 199

and this for a number up to 9:

  .db 74, 23
  .db 0
  .db 0
  .db 9
I found what's causing that; it's a display error. Doors CS happily counts to 200 when you increment from 199, but it's showing as 0 thanks to the dastardly BCall _SetXXOp1. I just realized that the XX refers to decimal digits instead of hex digits, which is pretty annoying. But the two-byte version is fine, because _SetXXXXOp2 allows up to 65535. I don't understand Texas Instruments at all. Sad I'll fix this glitch when I get home for the upcoming 7.2 Beta 3 of Doors CS, and I'll throw you a fixed version tonight.
So, I'm back with a new project, and sadly also a new problem: I have a GUIRLargeWin with GUIRWinButtons attached to them, but the win buttons are nut (fully?) drawn. However, it still works.

Here is the code:


#include "ti83plus.inc"
#include "dcs7.inc"
   .org progstart
   .db $BB,$6D
   xor d
   jr Start
   .dw Description
   .db $07,$00
   .dw Icon
   .dw $0000

  xor a
  call OpenGUIStack
  ld a, GUIRLargeWin
  ld hl, MainWin
  ld de, MainWinEnd - MainWin
  call PushGUIStack
  ld a, GUIRWinButtons
  ld hl, MainWinButtons
  ld de, MainWinButtonsEnd - MainWinButtons
  call PushGUIStack
  ld hl, 0
  call GUIMouse

  call ResetAppPage

   .db "Wiskunnend wiske",0
   .db %00111111, %11111000
   .db %01111111, %11111100
   .db %11111111, %11111110
   .db %11111111, %11111110
   .db %11101110, %11101110
   .db %11101110, %11101110
   .db %11110101, %01011110
   .db %11110101, %01011110
   .db %11110101, %01011110
   .db %11111011, %10111110
   .db %11111011, %10111110
   .db %11111111, %11111110
   .db %11111111, %11111110
   .db %01111111, %11111100
   .db %00111111, %11111000
   .db %00000000, %00000000

  .db %00000000, %10101000, %10101000, %01010000, %00000000
  .db "Wiskunnend Wiske",0

  .db %00100
  .dw $0000
  .dw $0000
  .dw Exit

and here is what it looks like:
The problem is the first line under "MainWinButtons". Namely, 0x04 is not equal to 0x80. Wink

.db %00100


.db %0010000
I don't know how that happened. That was stupid.

But it still has the same result Sad
My correction had a typo in that I still missed a zero. Did that solve it, by any chance?
yes, thank you.
ben_g wrote:
yes, thank you.
Superb, you're welcome. Let me know if you run into any further questions.
Sorry, but I have yet an other question (I really start feeling like a noob...):

In GUIRTextLineIn, there's a word I need to define:
5: Current offset from start of data string [2 bytes]
What does that do? And what's the recomended value? Everything I tried just seems to clear RAM when I try to edit it.
It should be 0. Remember that it's a .dw (2 bytes), not a .db. It should only be non-zero if (a) you're putting a string into the input box that the user should be editing and (b) you want the cursor to appear not at the beginning of the box.
Thank you.

also, is there a way to use a mousehook to force alpha mode to numerical input? I couldn't find it in the documentation.
ben_g wrote:
Thank you.

Is there a way to use a mousehook to force alpha mode to numerical input?
Not really, unfortunately; it's one of the things I regret about not allowing some kind of text input hook when I wrote the DCS GUI API. No hooks are active while the cursor is inside a text box, otherwise you could hackishly constantly set the alpha mode to numerical.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum