merthsoft wrote:
So next I need some GUI elements to pop up if a key is pressed during the mouse hook. This is what it looks like:

Code:
MouseHook:
    ld a,$fd    ;group for ENTER
    out (1), a
    nop \ nop    ;let the keyboard settle
    in a,(1)
    bit 0,a
    jr    z, ForceClick
    ld a,KeyRow_Top    ; group for the function row
    out (1),a
    nop \ nop
    in a,(1)
    cp dkY
    jr z,OpenNamesWindow
    ret

OpenNamesWindow:
   PushGUIStack(GUIRSmallWin, NamesWindow, NamesWindowE-NamesWindow)
   PushGUIStack(GUIRWinButtons, NamesWindowButtons, 7)
   GUIMouse(0)
   jp CloseNamesWindow
   
CloseNamesWindow
   PopGUIStacks(2)
   ret
When I press Y=, my calc crashes. What am I missing?


You oh so very VERY VERY VERY VERY VERY much can't PushGUIStack and re-invoke the GUIMouse from inside the MouseHook, which itself is called from the GUIMouse.
Hmm, I figured as much. So what's the right way to go about this?
merthsoft wrote:
Hmm, I figured as much. So what's the right way to go about this?
Using the move mouse / pop hl / ret method on an offscreen (X above 96) hotspot, which goes to a routine to do the pushes, and re-calls the GUIMouse. Don't forget to make a note of that so you'll know (1) not to allow the pushes to happen again, and (2) that you'll Pop two extra things at the end.
Ah, of course. That makes perfect sense! Thank you much.
So I've tried this, and I'm still not quite getting it. Forgive me if this is a little trivial, this weekend has been a little off:

Code:
MouseHook:
    ld a,$fd    ;group for ENTER
    out (1), a
    nop \ nop    ;let the keyboard settle
    in a,(1)
    bit 0,a
    jr    z, ForceClick
    ld a,KeyRow_Top    ; group for the function row
    out (1),a
    nop \ nop
    in a,(1)
    cp dkY
    jr z,OpenNamesClick
    ret
   
OpenNamesClick:
    ld hl, MouseY
    ld (hl), 1
    inc hl
    ld (hl), 1
    pop hl
    ret
   
OpenNamesWindow:
    call ResetAppPage
    PushGUIStack(GUIRSmallWin, NamesWindow, NamesWindowE-NamesWindow)
    PushGUIStack(GUIRWinButtons, NamesWindowButtons, 7)
    GUIMouse(0)
   
CloseNamesWindow
    PopGUIStacks(2)
    jp render

...

NamesWindowHotSpot:
   .db 0, 0
   .db 5, 5
   .dw OpenNamesWindow
NamesWindowHotSpotE:

NamesWindow:
   .db 2,2
   .db %01100000
   .db %11110000
   .db %10010000
   .db %11110000
   .db %01100000   
   .db "Names",0
NamesWindowE:
NamesWindowButtons:
   .db 1
   .dw 0, 0
   .dw CloseNamesWindow

NamesBox:
   .db 1,1
   .db 6
   .db 79
   .db 0,0
   .db 0
NamesBoxW:
   .db 7
I know the hotspot isn't off screen, it's just there for now.
Looks good except this, which is probably wrong:


Code:
    ld a,KeyRow_Top    ; group for the function row
    out (1),a
    nop \ nop
    in a,(1)
    cp dkY


Substitute $bf for KeyRow_Top. Substitute $EF for dKY. Unless you already went through and found those values, in which case tell me that I'm insulting your intelligence again.
Those are in keyvals.inc, actually. Substituting the values in that you gave yields the same results.
merthsoft wrote:
Those are in keyvals.inc, actually. Substituting the values in that you gave yields the same results.
Ah, thanks for trying that. And what result is that exactly? The menu doesn't open, or it crashes?
Here's a screen shot to help explain:

All those cursors happen when I hit Y=, the last thing when I hit Enter.
I am pretty sure that the hotspot you're clicking on doesn't cover (1,1), then?
It's at 0,0 and is 5x5! That should mean 1,1 is in there.
merthsoft wrote:
It's at 0,0 and is 5x5! That should mean 1,1 is in there.
I think you'd once again forgotten about the difference between screen coordinates and GUI coordinates. Wink
:'(
merthsoft wrote:
:'(
Was I correct? Does moving the mouse to y=10, x=1 do the trick? Smile
Very much so. The X button doesn't seem to be showing up, however.

EDIT: Fixed it. I misread the documentation.
merthsoft wrote:
Very much so. The X button doesn't seem to be showing up, however.

EDIT: Fixed it. I misread the documentation.
Woohoo! Another fire put out in Merth's ASM Woes. Wink
How do I make and use an appvar? (Links recommended if it's already out there).
merthsoft wrote:
How do I make and use an appvar? (Links recommended if it's already out there).
_CreateAppvar should do the trick. Try something like this:


Code:
   ld hl,MyAVName
    rst 20h
    bcall(_chkfindsym)
    ret nc   ;return if it exists
    ld hl,20 ;we'll make it be 20 bytes
    bcall(_CreateAppVar)
    ;..... more code....
    ret
MyAVName:
    .db AppVarObj,"MERTHROX",0
(a bit off topic, but I understand that O_O)
Why is there a ret?
  
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
» Goto page Previous  1, 2, 3, 4, 5, 6  Next
» View previous topic :: View next topic  
Page 4 of 6
» 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