how to move images in openoffice.org BASIC or LibreOfffice.org - openoffice-basic

After moving pictures in VBA using Shape.IncrementLeft and Shape.IncrementTop I would like to move pictures in openoffice.org BASIC code.
After searching internet with these keywords "move picture" and "openoffice.org" or "open BASIC" or "OOo BASIC" I did not find the answer.
I have found how to move pictures in Java, c++, android, but not in OpenOffice.org BASIC,
I read trough these guides
https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide
http://www.pitonyak.org/OOME_3_0.pdf
I tried to find the answer through LIBRE OFFICE also, but without success.
I tried to record a macro, insert a picture, move it with the mouse and stop the macro.
When looking into the code, the answer of my question take me to the dispatcher and one of the UNO methods, I believe is has something to do with these keywords:
Properties in the com.sun.star.awt.UnoControlImageControlModel service
com.sun.star.drawing.GraphicObjectShape
BorderBottom
BorderLeft
BorderRight
BorderTop
oPoint = oShape.Position
getPosition()
setPosition(Point)
but I cannot find a clear answer and I do not know how to combine them to make the image (or it can be a shape inserted also) to move.
can anybody guide me how to find the answer?

first of all: https://wiki.openoffice.org/wiki/Extensions_development_basic is a good starting point. In particular the XRAY tool is very helpfully.
The following Code changes the position of a selected Image on a Calc Worksheet:
Sub Test
dim aNewPosition as new com.sun.star.awt.Point
oDoc = thisComponent
oSelection = oDoc.CurrentSelection(0)
if oSelection.supportsService("com.sun.star.drawing.Shape") then
aPosition = oSelection.Position
x = aPosition.X
y = aPosition.Y
aNewPosition.X = x + 100
aNewPosition.Y = y + 100
oSelection.setPosition(aNewPosition)
endif
End Sub
Greetings
Axel

Related

Example third person controler in Unity / StringToHash

I am trying to learn game development through different ways and sources and recently I have created a project in unity with example ThirdPersonController.
While looking through the code I came across one thing which I am finding difficult to wrap my mind around. It is "StringToHash". What is the purpose of this? Here is an example of variable with specified values set:
private void AssignAnimationIDs()
{
_animIDSpeed = Animator.StringToHash("Speed");
_animIDGrounded = Animator.StringToHash("Grounded");
_animIDJump = Animator.StringToHash("Jump");
_animIDFreeFall = Animator.StringToHash("FreeFall");
_animIDMotionSpeed = Animator.StringToHash("MotionSpeed");
}
and here is an example when this is used when being called:
if (_hasAnimator)
{
_animator.SetFloat(_animIDSpeed, _animationBlend);
_animator.SetFloat(_animIDMotionSpeed, inputMagnitude);
}
Welcome to Stack overflow.
Similar question already has been asked HERE . Unity Docs .
In your code below you changing values (parameters) of your animator. To find which values it should change it must compare the name of the value you gave in .SetFloat to the ones it has (in "parameters" section on "animator" tab).
You could do
.SetFloat("speed", _animationBlend);
But to get that milliseconds of time advantage (optimization) your "speed" is converted to integers first (like in your code above) and then you use it.

How to access the child nodes in a device tree (DTS) in Zephyr using DT_FOREACH_CHILD

I'm developing an application for an nRF52 SoC to access some external devices, kind of detectors in this case, so I have defined a custom format (and its corresponding yaml file) for my device access description node. It is kind of:
n: detectors {
compatible = "foo-detectors";
// Definition of first channel
det0: det_0 {
irq-pins = <13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Bar detector channel 1";
};
// Definition of second channel
det1: det_1 {
irq-pins = <17 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Bar detector channel 2";
};
};
Suppose I have a structure definition for holding data about the pins to which those devices are physically connected, say:
struct foo_detector_desc {
int irqpin;
int irqpin_flags;
}
Using Zephyr macros, I can use from my code the individual values for those nodes. For instance, DT_PROP_BY_IDX(DT_NODELABEL(det0), irq_pins, 0) expands to 13, DT_PROP_BY_IDX(DT_NODELABEL(det0), irq_pins, 1) expands to the value of OR'ed flags GPIO_PULL_UP | GPIO_ACTIVE_LOW.
But I don't want to create a ten-page code full of conditionals in the form DT_NODE_EXISTS(DT_ALIAS(det#)), but something more compact, flexible and maintainable.
I came across Zephyr macro DT_FOREACH_CHILD that is intended for being used in that scenario with which I can create a list with the labels, as showcased in the example embedded in the documentation:
#define LABEL_AND_COMMA(node_id) DT_LABEL(node_id),
const char *child_labels[] = {
DT_FOREACH_CHILD(DT_NODELABEL(n), LABEL_AND_COMMA)
};
Trying to use that for filling a static structures array, I tried following code but, yet it expands to two elements in the array, the structure fields are not initialised with desired values.
#define PIN_INFO_AND_COMMA(node_id) \
{ \
.pin=DT_PROP_BY_IDX(node_id, irq_pins, 0),\
.flags=DT_PROP_BY_IDX(node_id, irq_pins, 1),\
},
const struct detector_data _det_data[] = {
DT_FOREACH_CHILD(DT_NODELABEL(n), PIN_INFO_AND_COMMA)
};
I'm using Visual Studio Code with the nRF Connect plugin.
Is there a way to generate/see how those macros expand when compiled?
What is the correct way for initialising the structure fields (pins, flags)?
BR
It is possible to expand the macros one level at a time in VS Code. It is needed to click over the macro, then select it by double-clicking on it, and a bulb light will, eventually, show up. The option Insert Macro will replace the macro with its expansion.
Regarding using the DTS in code, the code I wrote in my previous post is OK, but I think I found a bug in the debugger. If I don't include any code using the value of _det_data, the debugger doesn't say the constant was optimised-out and displays wrong values when inspecting its content. That made me waste a lot of time.
For anyone interested on using DTS files for nRF devices in Zephyr, I posted all details in a thread in Nordic's developers forum (here).
BR

decision tree in matlab - change font size

Could someone please assist:
Is there a way to change font size of classregtree in matlab?
How can I change the class labels?
Well, try this:
using an example from the docs:
load fisheriris;
t = classregtree(meas,species,...
'names',{'SL' 'SW' 'PL' 'PW'})
I was able to get the property-inspector:
tr=view(t)
inspect(tr)
..what didnt help a lot...
Now I took the handles of all children of tr, that are text-elements:
allHandles=findall(tr,'Type','text')
Next, I just changed the FontSize:
set(allHandles,'FontSize',16)
and there you go :) it is working!
To see and edit other properties, you could now use the inspect-method, as I was doing at my first try, but with the text-handles of course. normally, there should be all other properties available as for normal text-elements. Just check the docs for uicontrol + text.
Lucius's answer worked for me but instead of
tr=view(t)
I had to run this:
before = findall(groot,'Type','figure'); % Find all figures
view(t,'Mode','graph')
after = findall(groot,'Type','figure');
tr = setdiff(after,before); % Get the figure handle of the tree viewer
inspect(tr)

Keeping track of text position on pdf using FPDF and GetY

I am trying to keep track of the current Y position on a PDF page created using FPDF so that I can correctly start a new page ensuring tables do not cross a page break. Firstly am I right in using GetY to monitor this and if so what is the correct syntax. I am trying
$currentYposition = GetY();
but it does not seem to work. Any advice?
No idea why this works - but it does:
If you just grab Y after the call, it seems to be the value before the MultiCell.
Grabbing it before and after and taking the difference gives you the height.
$oldY = $this->getY();
$this->MultiCell(150, 4, utf8_decode($description), 0, "L");
$newY = $this->getY();
$multiCellHeight = $newY-$oldY;
This one worked for me.
$y = $pdf->GetY();
I came to this question when programming in python and using the fpdf module. I'll post in case anyone else need this, I could not find this solution in the official documentation but for me following worked:
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
current_y = FPDF.get_y(pdf)

Windows Automation with Matlab

Hello I'm trying to control FastHenry2 via Windows automation with Matlab.
I'm new to that topic. If I understood everything right I have to open it:
ax=actxserver('FastHenry2.Document');
and than run the function I want with the handle?
ax.Run('coils1.inp')
but that doesn't work. Matlab can't find Run and uses run instead, which is some build in Function not related at all with the problem. Also all other Function this UI should support don't work either. For Example FastHenry2.IsRunning or FastHenry2.GetInductance. So I guess I do something wrong with the whole UI handling. FastHenry provides an example script using VBS which I attached bellow and since it works fine FastHenry should be installed right on computer. I'm thankful for every hint I can get.
so long
eactor
The following VBS example works fine
Dim FastHenry2
pathPos = InstrRev(Wscript.ScriptFullName, Wscript.ScriptName)
path = left(Wscript.ScriptFullName, pathPos-1)
Set FastHenry2 = CreateObject("FastHenry2.Document")
couldRun = FastHenry2.Run("""" + path + "coils1.inp""")
Do While FastHenry2.IsRunning = True
Wscript.Sleep 500
Loop
inductance = FastHenry2.GetInductance()
WScript.Echo "Coils1 mutual inductance is " + CStr(inductance(0, 0, 1))
FastHenry2.Quit
Set FastHenry2 = Nothing
You might need to use an alternate syntax. Instead of
FastHenry2.Run('coils1.inp')
try this.
invoke(FastHenry2, 'Run', 'coils2.inp')
I've had to do this for some methods on the Excel.Application ActiveX control. I'm not clear why the first syntax doesn't work in some cases.