Can PowerBuilder 2017 be set to display line numbers? - line-numbers

I have recently upgraded from Powerbuilder 12.5 to PowerBuilder 2017. I know that the current line number (and column) is given at the bottom of the screen but can the line numbers be given next to each line?
Various Powerbuilder settings, looking on the net, and finding some useless answers.
IF X <> Y THEN
X = Y
END IF
I would rather see:
10 IF X <> Y THEN
20 X = Y
30 END IF

Showing line numbers in editor like you describe is not possible. The built-in editor is what we've had since the beginning.
Maybe with some C++ coding and PBNI it could happen not sure.

Related

Excel VBA Macros xlDays

I'm working on Line with markers chart. I have recorded a macro to create line chart (exactly xlLineMarkers). particularly x-axis with 7 days gap.
but it gives runtime error on
ActiveChart.Axes(xlCategory).MajorUnitScale = xlDays
I'm new to Excel VBA, please can anyone help?
apparently that doesn't work for my problem
i want to pick max and min date from datasheet and then display on x axis b y 1 week difference. can anybody help please ( in a deadlock :( )
[coding][1]
line chart
the code runs error free but doesnt show anything on x axis

In visual basic, is it possible to teleport my cursor to x*y coordinates (Not x,y)

So I have this program in visual basic that requires teleporting your cursor around and clicking. Kinda like an automatic cheat for a game but not really a cheat.
Anyways I want the user to set coordinates to a point, then set those coordinates to a value, then with the push of a button teleport to those coordinates.
Alright I can make him get the coordinates. I can make the cursor teleport. I can set the coordinates he got to an integer X and an integer Y so the cursor teleports there. But I have to do all that 8 times. So I need 24 integers.
I was thinking, maybe I can skip all that if I can multiply xy so lets say he sets the coordinates to 320 (x) and 72 (y). (320,72) Alright so If I multiply xy I get the pixel number on the screen that exists in that coordinate (right?)
Alright that makes it so we only have 8 integers which is much less.
But how do I make the cursor teleport to the location "X*Y" (in the case of 320*72 it is pixel number 23040).
*TL;DR is it possible to convert this Windows.Forms.Cursor.Position = New Point(320,72) into this Windows.Forms.Cursor.Position = New Point(23040 (which is 320*72))*
Is it possible?
I can't think of a way of doing it please help me. Thanks.
No. (x, y) is not equivalent to (x * y).
The reason why is obvious if you give it some thought. There are many different input values for x and y that would give the same product. For example, 6 * 1 = 6, and so does 2 * 3. Which location on the screen would 6 correspond to? The point at coordinates (6, 1), (1, 6), (2, 3), or (3, 2)?
There might be a better way of doing this, but I find the description in your question to be very difficult to understand. If all you want to do is simulate a click event at a particular location on the screen, you do not need to explicitly move the cursor there first. I'd suggest how to do that, but it is not clear what language you're using. You've tagged the question [vbscript], but then talked about Windows Forms, which doesn't exist in VBScript. If you are using VB.NET, you will probably end up P/Invoking the SendInput function. Google for code examples.
While I agree with other answers/comments, what you describe is possible, but you cannot simply multiply the x and y coordinates. You need to take the screen width into consideration:
Private Function PointToPixelNumber(pt As Point) As Integer
Return pt.Y * Screen.PrimaryScreen.Bounds.Width + pt.X
End Function
Private Function PixelNumberToPoint(pixelNumber As Integer) As Point
Return New Point(pixelNumber \ Screen.PrimaryScreen.Bounds.Width, pixelNumber Mod Screen.PrimaryScreen.Bounds.Width)
End Function
Please note that this code uses integer division (\). It also assumes that the origin is at the upper left of the screen and is zero based (i. e. the upper left coordinate is (0, 0))

Can't use all arguments with Shapes to control line in the GraphicsWindow

After trying a few things inside small basic to make a line follow the mouse but not move the entire line, I recently came across a problem. Originally I was trying to constantly have a line update so as it stays connected from one point to the mouse position by clearing the graphics window and redrawing a line from the bottom right to the mouse. This could not work and was to resource intensive. However, now I have come across Shape.addline and shape.move. But I'm not too sure as to how they work, from my understanding, a shape can have it's own name by doing:
[Shapename] = Shapes.addline(positions)
and then that shape can be moved using:
Shapes.move(Shapename,Coordinates)
In my case it's:
L1 = Shapes.AddLine(0,GraphicsWindow.Height,GraphicsWindow.MouseX,GraphicsWindow.MouseY)
(Drawing a line from the bottom left corner to the mouses position)
and
Shapes.Move(L1,GraphicsWindow.MouseX,GraphicsWindow.MouseY)
The only problem is that Shapes.Move only supports 3 arguments being:
shapeName
X
Y
But, when drawing the line (Shapes.AddLine), I use 4 arguments:
X1
Y1
X2
Y2
This means I can only control those two positions. So, how would you control the other two? If we can only modify X1 and Y1, is there any way of still using at least something similar to the shape.move method but be able to control the other X2 and Y2 positions? Primarily, I would like to actually Only change the X2 and Y2 positions, as I'm trying to make a line originate from one point and stay there, then alter the opposing point so that it follows the mouse, and not move the entire shape. If none of this is possible, is there any known way of moving / changing only the X2 and Y2 coordinates of a line without having to clear the entire screen?
Ah yes. These are the shortcomings of small basic. Shapes.move will not let you define a starting and ending point of a line. What you will need to do is move the center of the line in between the first point and the cursor, and the rotate it correctly. Like so:
Mouseline = Shapes.AddLine(0,0,100,0)
Shapes.Move(Mouseline,200,200)
GraphicsWindow.MouseMove = OnMouseMove
Sub OnMouseMove
XDif = (GraphicsWindow.MouseX-250)
YDif = (GraphicsWindow.MouseY-200)
If XDif <> 0 Then
MouseAngle = Math.ArcTan(YDif/XDif)
EndIf
If XDif < 0 Then
MouseAngle = MouseAngle + 3.14 '180 degrees in radians
EndIf
Shapes.Rotate(Mouseline,Math.GetDegrees(MouseAngle))
Shapes.Move(Mouseline,(Math.Cos(MouseAngle)*50)+200,(Math.Sin(MouseAngle)*50)+200)
EndSub
Another way of doing this is with the LitDev extension (http://litdev.co.uk/). It has a MoveLine(x1,y1,x2,y2) function in it.
im guessing u would alter the end of the program where it says math.cos(mouseangle) change the 200 to 0 and change the other 200 to the bottom. so if what im trying to figure out, ur trying to get the line to only project in the 1st quadrant in a cortesian plane yes?

VBA Macro 'Moving" Graphics / Dynamic Graphs

Basically, the problem here is that I have a macro which changes the number of a specific cell and by doing that I change the numbers from three columns and when those numbers are changed my graphic starts to 'move'.
To be more specific, I have this graphic:
When I click on the button I have, the lines starts to move, and it looks like a mouth opening and closing.
The blue line corresponds to the first and second column values, whereas the red line is changed accordingly to the first and third column values:
Cell(B2) contains the number generated by this code:
Sub OpenMouth()
For i = 1 To 20
Worksheets("Mouth").Cells(2, 2).Value = 0.1 + 2 * i / 20
Calculate
For j = 1 To 5000000
Next j
Next i
End Sub
What I need to do is to prepare something similar: A graphic that by changing the numbers I have in columns A, B and C, it starts to move. The columns A, B and C will be changed by doing a simple loop in VBA, this loop will change one value, and the three columns will have a formula linked to this value, so they will have their values changed.
I've seen some really cool graphics, a ball rolling, a wheel moving, but I really don't have a clue of how to do this, I don't know how to do it.
Does anyone have an idea? Can anyone help me build a different graphic with a similar idea (of an object moving)?
This is another example, using the same logic:
Frankly, I would suggest rethinking your approach of creating a custom & complex animation in Excel. Excel just isn't the right tool for this.
I would use Javascript and embed a Internet Explorer control into Excel with the animation. The solution would work as follows:
Press a button in Excel
A VBA macro executes the animation by loading the Microsoft Web Browser control with a custom HTML file with your animation in Javascript. The animation is show in the MS Web Browser Control.
Drawing in Javascript
Here a simple tutorial:
http://www.w3schools.com/html/html5_canvas.asp
Test your drawings here:
http://www.codecademy.com/courses/web-beginner-en-SWM11/0/1
Microsoft Web Browser Control
https://msdn.microsoft.com/en-us/library/aa752040(v=vs.85).aspx

Calculating multi-step math in a text box. - Visual Basic

I would like an application that I am creating in Visual Studio 2010 to be able to calculate a multi-step math problem that has been entered by the user into one whole text box.
ex. 3 * 55 / 7 ^ 2
The user would click a button, and the program would calculate the answer to the problem that they input. I was thinking something along the lines of:
Dim sngAnswer As Integer
sngAnswer = Val(Me.txtInput.Text)
But that doesn't work. Any ideas?
There is nothing included in the framework which will do this type of expression evaluation automatically.
You will likely want to use an expression parsing library to handle the math expression. NCalc and FLEE are both good options for this.