Post Reply 
Virtual calculator: "-" maped as +/-
08-28-2015, 05:07 PM (This post was last modified: 08-28-2015 05:07 PM by tecnovelez.)
Post: #1
Virtual calculator: "-" maped as +/-
In the virtual calculator I have seen that when we use the sign - on the numeric keyboard, which makes is +/- so that such a simple operation as 25-5 = 20, if you type as usual, 25 -20 = -2520
I checked in the manual that the "-" key on the numeric keypad is mapped to the virutal calculator such as +/-

I wonder if you think this solution is ok or you think it would be more correct than the minus "-" keyboard corresponds to subtract function.
Find all posts by this user
Quote this message in a reply
08-28-2015, 06:14 PM
Post: #2
RE: Virtual calculator: "-" maped as +/-
(08-28-2015 05:07 PM)tecnovelez Wrote:  I checked in the manual that the "-" key on the numeric keypad is mapped to the virutal calculator such as +/-

I wonder if you think this solution is ok or you think it would be more correct than the minus "-" keyboard corresponds to subtract function.
You can change the key assignments in the *.skin files.

Franz
Visit this user's website Find all posts by this user
Quote this message in a reply
08-29-2015, 11:10 AM
Post: #3
RE: Virtual calculator: "-" maped as +/-
I am sorry. I have not expressed correctly.

The issue is not with the key assignment in the skin file.

The issue is that the "-" key on the numeric keyboard of my pc (I checked in several pcs) works in the virtual calculator as "+/-", when in my opinion should be "-" subtract.

But certainly this is not a malfunction of the virtual calculator, because that is declared in the help document.
Find all posts by this user
Quote this message in a reply
08-30-2015, 02:21 AM
Post: #4
RE: Virtual calculator: "-" maped as +/-
I'd be very interested to knowing the design of the skin.xml files are, too.
Maybe Tim (please, please) could give us a manual that describes the design details of the skin.xml files.

I would love to swap the "-" and the "+/-" on the PC keyboard. The only thing I could find in the skin.xml file regarding "minus" was the following.

Keypad:
<key id = "KEY_MINUS" label = "- (Minus)" />

Keyboard:
<emu_key_code name = "KEY_MINUS">
<win_os_key_msg>109</win_os_key_msg>
<win_os_key_msg>189</win_os_key_msg>
<pixel_region>
<origin x = "253" y = "587" />
<dimensions width = "47" height = "32" />
<function name = "invertRegion" />
</pixel_region>
</emu_key_code>
Find all posts by this user
Quote this message in a reply
08-30-2015, 08:44 AM
Post: #5
RE: Virtual calculator: "-" maped as +/-
(08-30-2015 02:21 AM)Skyblues Wrote:  I would love to swap the "-" and the "+/-" on the PC keyboard.
The line in any *.skin file for this is:
key=27,85,518,128,553,{109},{},{},["m""M"] #chs

109 is the scancode for the key <Num-> (on the numeric keypad), if you change this number to 189 then #chs is mapped to the regular minus key, and <Num-> works again as #minus.

Franz
Visit this user's website Find all posts by this user
Quote this message in a reply
08-30-2015, 07:00 PM
Post: #6
RE: Virtual calculator: "-" maped as +/-
(08-29-2015 03:44 PM)Spybot Wrote:  Hi tecnovelez! I've noticed that too.

but look... we usually have two "-" keys in our keyboards, one in the numeric pad and the other one on the numeric row that is above the letter keys. when using virtual calculator... one behaves as "-" and the other as "+/-".
I'd also like to have the "-" key that is in the numeric pad to act as the regular "minus sign", but I guess this is just the way things are now, hopefully future versions of the virtual calculator change that. I hope you find this useful.

Thanks Spybot, that was what I was doing untill fhub posted next thread


(08-30-2015 08:44 AM)fhub Wrote:  
(08-30-2015 02:21 AM)Skyblues Wrote:  I would love to swap the "-" and the "+/-" on the PC keyboard.
The line in any *.skin file for this is:
key=27,85,518,128,553,{109},{},{},["m""M"] #chs

109 is the scancode for the key <Num-> (on the numeric keypad), if you change this number to 189 then #chs is mapped to the regular minus key, and <Num-> works again as #minus.

Franz

YESSSSS FRANZ.... thanks a lot.. this is the solution I was looking for. I have made the changes and now all is working as I expected.

But now a new problem ... my natural concern and willingness to learn want to know what I've done ....

As indicated skyblues, I think it would be very interesting to know the internal structure for the skin files.
Find all posts by this user
Quote this message in a reply
08-31-2015, 02:07 AM
Post: #7
RE: Virtual calculator: "-" maped as +/-
Franz,

That works perfect, thanks a lot for the info.

Question: where does one find this information described? Where are the the scancodes for the keys defined/explained?

Same as tecnovelez, I would love to understand the internal structure for the skin files.

Thanks much!
Jim
Find all posts by this user
Quote this message in a reply
08-31-2015, 03:06 AM
Post: #8
RE: Virtual calculator: "-" maped as +/-
(08-31-2015 02:07 AM)Skyblues Wrote:  Franz,

That works perfect, thanks a lot for the info.

Question: where does one find this information described? Where are the the scancodes for the keys defined/explained?

Same as tecnovelez, I would love to understand the internal structure for the skin files.

Thanks much!
Jim

http://www.qb64.net/wiki/index.php/Keyboard_scancodes

I built a small editor for the skin files a while ago: http://www.hpmuseum.org/forum/thread-859.html

You can set up to 3 keycodes with each key. Not sure if the files have changed since then but it might help you futher undestand the skin files

My website: ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
08-31-2015, 04:14 AM
Post: #9
RE: Virtual calculator: "-" maped as +/-
Thanks eried, much appreciated!

Jim
Find all posts by this user
Quote this message in a reply
08-31-2015, 05:10 AM
Post: #10
RE: Virtual calculator: "-" maped as +/-
Hello,

I am not 100% that this documentation is up to date, but it will give you a lot of info nevertheless..

/** \file skin.h

The main purpose of the Skin system is to provide the user with oportunity to
change the graphical representation of the calculator.
this is done by storing all data nessecary (such as the name of the .bmp file that
represents the calculator, the position of all keys and the definition of the screen)
in a text file with a .skin extention. the skin.dll file
provides a CSkin object that can read all that data and store it useable format.


the format of the text file is as follow:

#comments start with #
#the filename for the picture In order to allow for long filename, the name starts after the =
#and ends at the end of the line
picture=file
#the size of the visible part of the picture when the window border is visible
size=w*h
#the list of points that bounds the visible part of the picture when the window border is NOT visible
border=x1,y1,x2,y2...xn,yn # polygon for borderless mode
#the position and size of the screen in the picture
screen=x,y,w,h
#screen foreground and background colors (6 digit RGB color)
screenfore=ab12dc
screenback=001241
#for each calculator key, have a key entry.
#the first parameter is the code that is used by the calculator firmware
#after that, you have the x/y coordinates of the key on the picture
#followed by a list of PC keyboard keycode that will activate the key
#and optionally a location of a 'pressed' key picture (in the picture file) that is used when the key is pressed
#note that the number of keycodes associated with a key is limited to 10
#keycode is the scan key number. note that if shift key is pressed down, 1000 is added to that number
#so that % (shift 5) is 1053
#if text "t" is specified, it will try to match text typed on the keyboard with the key
key=["t",]code,x1,y1,x2,y2,{keycode1[,keycode2...,keycoden]}[,{shift key codes. ie keycode that will produce a shifted versino of this key}][,{Alpha keycodes}][,["text associated with the key for reverse lookup""more"...]][,sx,sy]
#these last 2 items are used to assign a key to the mouse right and middle buttons.
#they will usually be assigned to the shift keys...
mright=code
mmiddle=code
#the next part are the screen polygon definitions... they should be one for each pixel of the screen
#the uppercase version if for high resolution copy and paste. SCREEN is the size of the screen
#for high resolution
#if the pixel number is NEGATIVE (ie, starts with a -, even if it's -0), then the syntax is:
#poly=-pixel,x,y,w,h,sx,sy where x/y/w/h is the destination position and size and sx/sy is the source location
#in the backgroud image used to draw...
poly=pixel,{x1, y1, x2, y2....,xn,yn}[{next polygon}]+
POLY=pixel,{x1, y1, x2, y2....,xn,yn}
SCREEN=w*h
#express that the screen is a matrix of w*h pixels with n native pixels per matrix pixels
MATRIX=w,h,ps,TopLine
#says that there is an indicator at location x, y, size w, h on the main picture to display on the LCD
indic=nb,x,y,w,h
MAXIMIZED=x,y,w,h
# specifies which part of the background picture to display in maximized form...
MAXIMIZED1=x,y,w,h,KeyOffsetX,KeyOffsetY
MAXIMIZED2=x,y,w,h,KeyOffsetX,KeyOffsetY
# specifies that the background picture is in 2 parts that needs to be merged for maximized form
# also specifies an offset to add to the keyboard points location for key maping to skin
*/

Cyrille
Find all posts by this user
Quote this message in a reply
08-31-2015, 12:14 PM (This post was last modified: 09-03-2015 10:31 PM by matthiaspaul.)
Post: #11
RE: Virtual calculator: "-" maped as +/-
Thanks, Cyrille, this documentation will prove to be useful for Prime users.

For the HP 50g Virtual Calculator (which uses .xml files rather than .skin files) I have found out most of the settings myself by trial and error (developing a new, much improved skin for the emulator), so such a documentation is no longer necessary (although it would still be nice, if you could provide one), but there's one question remaining:
In that emulator (in the skin.xml files) virtual Windows keycodes (rather than actual keyboard scancodes) are mapped to emulator entries which appear to be organized in some kind of grid in emu_keys.xml (possibly a keyboard switch matrix or other kind of port mappings). This works okay for basic key assignments, but it does not seem to allow to map alternative PC keyboard assignments (that is, according to the PC keyboard driver loaded) to emulator entries.
I can assign a digit key in the digit key row of the main keyboard block to a digit key on the calculator, but it seems I cannot assign the shifted function of the same digit key to a different function on the calculator (shifted or not on the calculator).
For example, while I would like to assign the unshifted function of the "8/(" key (in the German keyboard layout) to the emulator entry for the "8" button (as it happens already for 00040005h), I would like to assign the shifted PC key function "(" to either the emulator entry for the "+" key or even better to an emulator entry for "LSHIFT (white)"+"+" (if there were (undocumented) entries in the emulator's grid for such combinations as well). If this would be possible (as it is apparently in the Prime emulator), it would open alot of possibilities to more closely emulate the calculator's key assignments on a PC keyboard. After all, alot of the "special symbols" are readibly available in most keyboard layouts on the shifted layers, but cannot be used as the emulator "consumes" whole keys only. Is there a workaround for this?

Greetings,

Matthias


--
"Programs are poems for computers."
Find all posts by this user
Quote this message in a reply
09-01-2015, 05:19 AM
Post: #12
RE: Virtual calculator: "-" maped as +/-
Hello,

I do not have the 50g xml format doc around me, sorry and it's too far away for me to remember...

But yes, scan codes vs key presses are a pain in the rear end for emulator, especially when it comes to shift.

Is the shift of a PC keyboard the shift of the unshifted calc key or the PC shifted key?
What to use as a shift? using the PC shift obviously does not work if you need access to the PC shifted key. Are the PC shifted keys really useful? well, on an AZERTY keyboard, all the numbers are shifted!

Can you use ALT as a calculator shift key? well, once again, Alt is used as a PC shift key on some keyboards ({} and [] for example are Alt-Gr 4, 5, ° and + on AZERTY)!

I honestly blame the early PC keyboard design for this, they should have had the KEYBOARD be aware that it is AZERTY/QWERTY and have the keyboard type be transparent to the PC, but they did not and it makes a mess today...

Cyrille
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)