Calculator Community > ASM

HotkeySE | DoorsCS

<< < (2/3) > >>

NonstickAtom785:
I was trying to make the buttons make sense when I was programming them(thanks Zeda). I'm making an extra configuration program that will change what key performs an action. I intentionally left out the delete action because I didn't want anybody or myself to accidentally delete something. But I'm going to modify it so that it won't be available until you run and configure that action to the specified key. What I need help with is getting the key name based off the key that is pressed. Any ideas as to what I should do in this scenario? (F.Y.I I'm using Axe but some native assembly code will help me a bunch too!)

I was thinking of making a zero terminated list of strings and using str-Get() to get the string based off of the key, but the only problem is how to set up the routine to do that since there are keys that cannot be used...(enter, on, graph, xton, stat, arrows, alpha, and shift)

Xeda112358:
What you could do is have a simple menu where the user can move a cursor to highlight an option (like "Edit"), then they press a button to assign to that option. Your code looks for the string associated with the keypress, and if the string is empty (i.e., starts with a null byte), then it isn't a valid option. You also need to verify the keypress isn't already assigned to an option.

It's basically your idea, using an empty string to signify the keypress is invalid.

NonstickAtom785:

--- Quote from: Xeda112358 on September 21, 2020, 04:32:17 pm ---What you could do is have a simple menu where the user can move a cursor to highlight an option (like "Edit"), then they press a button to assign to that option. Your code looks for the string associated with the keypress, and if the string is empty (i.e., starts with a null byte), then it isn't a valid option. You also need to verify the keypress isn't already assigned to an option.

It's basically your idea, using an empty string to signify the keypress is invalid.

--- End quote ---

I can't figure out how to make a list of zero terminated strings in axe without entering in the hex codes. Does anyone know if that's possible?

Xeda112358:
I think you can do something like:

--- Code: ---"HELLO"→Str1
"WORLD"[00]
"THIS"[00]
"IS"[00]
"A"[00]
"TEST"[00]

--- End code ---

Then Str1 points to the first zero-terminated string (note that Axe will automatically tack on a 00 when you → a string)

NonstickAtom785:
That was useful. So I made a table of all the keys and also realized that I can't use +,-,/, and * either. So I took those out of the equation. I added a section with all of the possible keys. With that I will do something like this:

--- Code: ---If inData(GDB1,getKey)->A
strGet(Str1,startOfTable-A
End

--- End code ---


Edit: I can't seem to get my code to print accurate results but when I use just the routine and output it they are fine here is the current code.

--- Code: ---Return!If GetCalc("prgmSEHTKY")->A
+100->B
Fix 5:ClrDraw
Text(1,0,"HotkeySE Config")
RectI(0,0,49,7)
HLine(
Text(3,9,"Edit:")
Text(3,15,"Lock:")
Text(3,27,"Arch:")
Text(3,33,"Cut:")
Text(3,39,"Copy:")
Text(3,45,"Paste:")
Text(3,51,"Rename:")
Text(3,57,"Folder:")
For(G,0,8)
GKY()
End
DispGraph
Lbl GKY
If inData({G+B},GDB1)->C
strGet(Str1,C-1)->D
Text(35,6*G+9,D
End
[343337382F2E2D2C2B2A272625211F1E1D19171615110E00]->GDB1"[window]"[00]->Str1
"[zoom]"[00]
"mode"[00]
"[del]"[00]
"[x^-1]"[00]
"[x^2]"[00]"[log]"[00]
"[ln]"[00]
"[sto]"[00]
"[apps]"[00]
"[sin]"[00]
"[,]"[00]
"[0]"[00]
"[prgm]"[00]
"[cos]"[00]
"[(]"[00]
"[.]"[00]
"[vars]"[00]
"[tan]"[00]
"[)]"[00]
"[(-)]"[00]
"[^]"[00]
--- End code ---


And here is the code that outputs the correct data:

--- Code: ---;Same data as above...
ClrHome
Repeat getKey
End
If inData(,GDB1)->A
strGet(Str1,A-1)->B
End
Output(0,0,B)

--- End code ---


Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version