Hi guys !

I'm learning how to use the DCS7 GUI API, and I'm encountering several problems Confused

I made a simple GUI with a large window, a text button, a close button and a text which is invisible first. I want the button to make the text visible, but the prgm quits anyway after the call GUIMouse. Here is the code :


Code:
   org   userMem - 2
   db   0BBh, 6Dh
   xor   d
   ret

   jr   Start

; Description
   word   Desc
   db   7, 0
; Icon
   word   0
; ALE
   word   0
Start:
   ld   a, 0
   ld   (dispText), a
   ld   (mustExit), a
   call   OpenGUIStack
   ld   hl, myWin
   ld   de, myWinWinButtons - myWin
   ld   a, GUIRLargeWin
   call   PushGUIStack
   ld   hl, myWinWinButtons
   ld   de, myWinText - myWinWinButtons
   ld   a, GUIRWinButtons
   call   PushGUIStack
   ld   hl, myWinButton
   ld   de, dataEnd - myWinButton
   ld   a, GUIRButtonText
   call   PushGUIStack
   ld   a, (dispText)
   or   a
   jr   z, skipText
   ld   hl, myWinText
   ld   de, myWinButton - myWinText
   ld   a, GUIRText
   call   PushGUIStack
skipText:
   ld   hl, 0
   call   GUIMouse
   call ResetAppPage
   ld   a, (mustExit)
   or   a
   jr   z, Start
   call   CloseGUIStack
   ret

onButtonClick:
   call   ResetAppPage
   ld   a, 1
   ld   (dispText), a
   ret

exitProg:
   call   ResetAppPage
   ld   a, 1
   ld   (mustExit), a
   ret

Desc:
   db   "Simple test", 0
; Widgets data
myWin:
   db   0F8h, 88h, 88h, 88h, 0F8h
   db   "Hello world", 0
myWinWinButtons:
   db   00100000b
   word   0
   word   0
   word   exitProg
myWinText:
   db   0, 0, 0
   db   "Hello world!", 0
myWinButton:
   db   40, 20
   word   onButtonClick
   db   "Button", 0
dataEnd:
; Misc. datas
dispText:
   db   0
mustExit:
   db   0


Do you see anything wrong in it ?
Well, the exitProg and onButtonClick never remove the old items from the GUI stack and jump back to Start. Remember, GUIMouse acts like a jp, even though it's a call. Smile
In fact it's ok, Runer112 gave me a solution on Omnimaga Smile


Code:
dw $C0DE

; Alert(
; Displays a modal msg box with custom text

dw AlertEnd+6                       ; I use REP_NEXT twice and OFS_NEXT twice  **CHANGED**
db %00001000                      ; only for DoorsCS
db $BB,$1B                            ; normalpdf(
db 1                                       ; subroutine  **CHANGED**
db 1                                       ; 1 arg

rorg 0
 push hl
 inc hl
 inc hl
 inc hl
 call sub_Length
 ex de,hl
 push de
 call OpenGUIStack

 REP_NEXT                            ; db $7F  rorg $-1
 ld hl,sub_Axiom2                    ;  **CHANGED**
 ld de,WinButtons-SmallWin
 ld a,GUIRSmallWin
 call PushGUIStack
 
 ;  **CHANGED**

 REP_NEXT                            ; db $7F  rorg $-1
 ld hl,exitAx1
 REP_NEXT(5+WinButtons-SmallWin)    ; db $40  db 5+WinButtons-SmallWin  rorg $-2
 ld (sub_Axiom2),hl
 REP_NEXT(WinButtons-SmallWin)    ; db $40  db WinButtons-SmallWin  rorg $-2
 ld hl,sub_Axiom2
 ld de,AlertEnd-WinButtons
 ld a,GUIRWinButtons
 call PushGUIStack
 
 pop de
 pop hl
 inc de
 inc de
 inc de
 ld a,GUIRText
 call PushGUIStack

 ld hl,0
 call GUIMouse
 ret

exitAx1:
 call ResetAppPage
 ret

AlertEnd:


;** CHANGED **

dw DataEnd
db %00001000
dw 0
db %00010000
db 0

rorg 0
SmallWin:
db 7,7
db $E0,$B0,$90,$90,$F0
db " ",0

WinButtons:
db %00100000
dw 0
dw 0
dw 0                           ;  **CHANGED**, although it doesn't really matter

DataEnd:


dw 0                                     ; AXM_END

; token hook
dw $03E0                             ; hnormalpdf
db 6
db "Alert("


I'll keep this thread in case of I encounter other problems Smile
Excellent, please do so. Smile And of course keep us updated on your progress as you go. Do you have the DCS SDK PDF for reference?
  
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 UTC - 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

 

Advertisement