Virtual Numpad
-
- Posts: 6
- Joined: Wed Jul 31, 2019 8:52 pm
Virtual Numpad
Hi guys,
I would like a virtual numpad in my calc file that I can use on a device without physical keyboard.
I have a POS with touchscreen and I don't want to use the on screen keyboard Windows provides.
I tried to do buttons that insert numbers and dot, a button that clears a cell, and an OK buttons that acts like the Enter button but it didn't work properly.
Thanks!
I would like a virtual numpad in my calc file that I can use on a device without physical keyboard.
I have a POS with touchscreen and I don't want to use the on screen keyboard Windows provides.
I tried to do buttons that insert numbers and dot, a button that clears a cell, and an OK buttons that acts like the Enter button but it didn't work properly.
Thanks!
OpenOffice 4.1.6
Windows 10
Windows 10
Re: Virtual Numpad
Please upload your macros and the .ods sample file here.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Virtual Numpad
Code: Select all
Sub appendChar(e)
s = e.Source.Model.Tag
view = ThisComponent.getCurrentController()
cell = view.getSelection()
c = cell.getString()
cell.setFormula(c & s)
End Sub
Repeat = Yes
Take focus = No
Additional info = the character to be appended
Execute Action Event = the above macro
The spreadsheet selection needs to be a single cell.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 6
- Joined: Wed Jul 31, 2019 8:52 pm
Re: Virtual Numpad
Hi,
Right now the dot isn't working. I can "type" in a cell .2, but it doesn't work for 1.2 or 0.2.
Right now the dot isn't working. I can "type" in a cell .2, but it doesn't work for 1.2 or 0.2.
Code: Select all
Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Sub RoundedRectangle1_Click()
ActiveCell.Value = ActiveCell.Value & "1"
End Sub
Sub RoundedRectangle2_Click()
ActiveCell.Value = ActiveCell.Value & "2"
End Sub
Sub RoundedRectangle3_Click()
ActiveCell.Value = ActiveCell.Value & "3"
End Sub
Sub RoundedRectangle5_Click()
ActiveCell.Value = ActiveCell.Value & "5"
End Sub
Sub RoundedRectangle4_Click()
ActiveCell.Value = ActiveCell.Value & "4"
End Sub
Sub RoundedRectangle6_Click()
ActiveCell.Value = ActiveCell.Value & "6"
End Sub
Sub RoundedRectangle7_Click()
ActiveCell.Value = ActiveCell.Value & "7"
End Sub
Sub RoundedRectangle8_Click()
ActiveCell.Value = ActiveCell.Value & "8"
End Sub
Sub RoundedRectangle9_Click()
ActiveCell.Value = ActiveCell.Value & "9"
End Sub
Sub RoundedRectangle0_Click()
ActiveCell.Value = ActiveCell.Value & "0"
End Sub
Sub RoundedRectangle11_Click()
ActiveCell.Value = ActiveCell.Value & "."
End Sub
Sub RoundedRectangle12_Click()
ActiveCell.Value = ""
End Sub
Sub RoundedRectangle13_Click()
Activecell.value=CDbl(Activecell.value)
If activeCell.Value = "" then
activeCell.value = ""
end if
If ActiveCell.Column = 1 Then
ActiveCell.Offset(1, 0).Select
End If
End Sub
- Attachments
-
- Cash reconciliation.ods
- (19.46 KiB) Downloaded 132 times
Last edited by robleyd on Fri Aug 02, 2019 1:31 pm, edited 1 time in total.
Reason: Add code tags
Reason: Add code tags
OpenOffice 4.1.6
Windows 10
Windows 10
Re: Virtual Numpad
You could use a publicly declared variable and clear it back to 0 on OK
Code: Select all
dim v
Option VBASupport 1
Sub RoundedRectangle1_Click()
v = v & "1"
ActiveCell.Value =v
End Sub
'etc etc
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
-
- Posts: 6
- Joined: Wed Jul 31, 2019 8:52 pm
Re: Virtual Numpad
The variable should clear back to 0 on OK or if I select another cell. How do you do that?JeJe wrote:You could use a publicly declared variable and clear it back to 0 on OK
Code: Select all
dim v Option VBASupport 1 Sub RoundedRectangle1_Click() v = v & "1" ActiveCell.Value =v End Sub 'etc etc
OpenOffice 4.1.6
Windows 10
Windows 10
Re: Virtual Numpad
Right click on the tab for the sheet... pick "Sheet Events"... try setting back to 0 on selection changed event...
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
-
- Posts: 6
- Joined: Wed Jul 31, 2019 8:52 pm
Re: Virtual Numpad
Everything works fine so far, thank you all for your help.
I have one more question. I want the C button to clear two or more selected cells.
I have one more question. I want the C button to clear two or more selected cells.
OpenOffice 4.1.6
Windows 10
Windows 10
Re: Virtual Numpad
You can use the macro recorder to find solutions like this...
Code: Select all
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Flags"
args2(0).Value = "A"
dispatcher.executeDispatch(document, ".uno:Delete", "", 0, args2())
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
-
- Posts: 6
- Joined: Wed Jul 31, 2019 8:52 pm
Re: Virtual Numpad
I hoped the answer would have been something like " activecellselection.value = "" " because anything more complicated exceeds my "coding" capability (wich is almost inexistent).JeJe wrote:You can use the macro recorder to find solutions like this...
[/code]
Sadly, I can't understand anything from the macro recorder.
After I manually select two or more cells, I would like the C button to do the same thing the backspace button does, or change the value of every selected cell to "". If there's a simple command to be written, I appreciate if you tell me.
Righ now the C button does this:
Code: Select all
Sub RoundedRectangle12_Click()
ActiveCell.Value = ""
v= 0
End Sub
OpenOffice 4.1.6
Windows 10
Windows 10
-
- Posts: 6
- Joined: Wed Jul 31, 2019 8:52 pm
Re: Virtual Numpad
Thiscomponent.CurrentSelection.ClearContents(1 OR 2 OR 4 OR 8 OR 16 OR 32 OR 64 OR 128 OR 256 OR 512)
Everything is working perfectly.
Thank you guys very much for your help!
Code: Select all
Sub RoundedRectangle12_Click()
ActiveCell.Value = ""
Thiscomponent.CurrentSelection.ClearContents(1 )
v= 0
End Sub
Thank you guys very much for your help!
OpenOffice 4.1.6
Windows 10
Windows 10
Re: Virtual Numpad
You don't have to understand anything from the macro recorder - that's the point of it. The above was what you get when you press the delete key and choose delete all from the pop up dialog. Here's what you get when you press the backspace... note the similarity to your post...
Code: Select all
sub whateveryouwanttocallthesub
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:ClearContents", "", 0, Array())
end sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)