Post Reply 
Keeping graphic objects in programs
12-20-2020, 08:51 PM
Post: #21
RE: Keeping graphic objects in programs
(12-19-2020 04:44 PM)Han Wrote:  The CK should have a "Content" pane. Drag your png files from the calculator to the Content area. This is a directory in the computer -- you can find the directory in Edit > Preferences.

Dear Mr. Han,
This is not working. I don't know what's going wrong, but the files listed cannot be copied to the directory in the CK. Although they are indeed listed in the CK's app under files, this appears to be fake. What to do next? Sincerely, Karel.

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
12-26-2020, 05:46 AM
Post: #22
RE: Keeping graphic objects in programs
(12-20-2020 08:51 PM)cahlucas Wrote:  
(12-19-2020 04:44 PM)Han Wrote:  The CK should have a "Content" pane. Drag your png files from the calculator to the Content area. This is a directory in the computer -- you can find the directory in Edit > Preferences.

Dear Mr. Han,
This is not working. I don't know what's going wrong, but the files listed cannot be copied to the directory in the CK. Although they are indeed listed in the CK's app under files, this appears to be fake. What to do next? Sincerely, Karel.

Just to be sure, you are dragging the app itself from the apps within the calculator into the Content pane (just below the calculator), correct? Once the app has been "copied" in this fashion, only then will it appear in the appropriate directory on your computer. So which step is failing? Dragging the app itself into the Content pane?

Is there any sort of error message or window?

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
12-26-2020, 06:00 PM
Post: #23
RE: Keeping graphic objects in programs
(12-26-2020 05:46 AM)Han Wrote:  Just to be sure, you are dragging the app itself from the apps within the calculator into the Content pane (just below the calculator), correct? Once the app has been "copied" in this fashion, only then will it appear in the appropriate directory on your computer. So which step is failing? Dragging the app itself into the Content pane?

Is there any sort of error message or window?
Dear Mr. Han,
The files are still on the computer. I may have looked in the wrong places, but in the derectory 'HP Connectivity Kit/Calculators/HP Prime from Karel Lucas' is the directory of my app with the .PNG files. These files look good in Preview, without distortion, and exactly as they are drawn by the program. The only thing I don't know is whether these files, once on the Prime, will also be the same size, so there will be no size increase or reduction. Also in this directory are the files ending in .hpapp, .hpappnote, and .hpappprgm. The first two will be worthless and the last contains the unmodified program as created by me. The program must now be modified in such a way that these .PNG files can be used, the question is how that can be achieved. I hope to hear from you soon. In the meantime, I want to wish you a Merry Christmas and a Happy New Year! Sincerely, Karel.

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
12-27-2020, 06:21 AM
Post: #24
RE: Keeping graphic objects in programs
(12-26-2020 06:00 PM)cahlucas Wrote:  Dear Mr. Han,
The files are still on the computer. I may have looked in the wrong places, but in the derectory 'HP Connectivity Kit/Calculators/HP Prime from Karel Lucas' is the directory of my app with the .PNG files. These files look good in Preview, without distortion, and exactly as they are drawn by the program. The only thing I don't know is whether these files, once on the Prime, will also be the same size, so there will be no size increase or reduction.

It looks like you managed to find a way to get the pictures from the calculator onto your computer, then. They will remain exactly as you see them unless you specifically modify them yourself.

Quote:Also in this directory are the files ending in .hpapp, .hpappnote, and .hpappprgm. The first two will be worthless and the last contains the unmodified program as created by me. The program must now be modified in such a way that these .PNG files can be used, the question is how that can be achieved. I hope to hear from you soon.

What you can do is create a virtual calculator (this is freely available if you have not already downloaded it). Then "send" the program to the virtual calculator (using the CK -- either from the real calculator, or from the Content pane where your app was copied to previously). Once the virtual calculator has the copy, you can then proceed to edit your program from the CK and test everything on the virtual calculator. Once all is ready to try on a real calculator, send it from the virtual calculator to the real on (again using the CK).

Quote:In the meantime, I want to wish you a Merry Christmas and a Happy New Year! Sincerely, Karel.

Merry Christmas (albeit a few days late :-) and Happy New Year to you as well!

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
12-27-2020, 06:11 PM
Post: #25
RE: Keeping graphic objects in programs
(12-27-2020 06:21 AM)Han Wrote:  What you can do is create a virtual calculator (this is freely available if you have not already downloaded it). Then "send" the program to the virtual calculator (using the CK -- either from the real calculator, or from the Content pane where your app was copied to previously). Once the virtual calculator has the copy, you can then proceed to edit your program from the CK and test everything on the virtual calculator. Once all is ready to try on a real calculator, send it from the virtual calculator to the real on (again using the CK).
Dear Mr. Han,
But how can I call those .PNG files from my program? Of course these should be in the same directory as the program, but I don't know how to use them. I also have another problem. In my application I use a square black cursor that, depending on the settings, must be projected over more or less square boxes in a grid, such that the character in it is visible in reverse video. The problem occurs when touching the screen on one of those boxes. The cursor must then immediately land on that box, and the content of that box can then be changed via the keyboard. Each box has an index number, and the difficulty now is to translate the mouse coordinates of the touch on the screen to the correct index number in the most efficient way possible. An additional problem is that the index numbers are not logically related to the boxes on the screen. This portion of the code will be critical to the correct operation of the program. And I don't have enough experience programming the Prime yet to implement this in the most efficient way. I hope I am not asking too much of you now, although I am confident that your knowledge and experience will be more than sufficient to overcome this problem. I am curious about your answer. Sincerely, Karel.

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
12-27-2020, 11:43 PM
Post: #26
RE: Keeping graphic objects in programs
(12-27-2020 06:11 PM)cahlucas Wrote:  Dear Mr. Han,
But how can I call those .PNG files from my program? Of course these should be in the same directory as the program, but I don't know how to use them.

You will need to make use of the DIMGROB and BLIT commands. These commands also have a _P variation (i.e. DIMGROB_P and BLIT_P) that act on pixel-based screen coordinates. The non-"_P" versions use the current user's graphics settings. Generally speaking, prepare a graphics object (use the variables G1 through G9, as G0 is the current screen) using the DIMGROB command, and then "store" the PNG files into these graphics objects (use something like G1:=AFiles("mypicture.png"). Lastly, use the BLIT command to "draw" the graphics variable (G1 through G9) onto the screen (G0).

Quote:I also have another problem. In my application I use a square black cursor that, depending on the settings, must be projected over more or less square boxes in a grid, such that the character in it is visible in reverse video. The problem occurs when touching the screen on one of those boxes. The cursor must then immediately land on that box, and the content of that box can then be changed via the keyboard. Each box has an index number, and the difficulty now is to translate the mouse coordinates of the touch on the screen to the correct index number in the most efficient way possible. An additional problem is that the index numbers are not logically related to the boxes on the screen. This portion of the code will be critical to the correct operation of the program. And I don't have enough experience programming the Prime yet to implement this in the most efficient way. I hope I am not asking too much of you now, although I am confident that your knowledge and experience will be more than sufficient to overcome this problem. I am curious about your answer. Sincerely, Karel.

It may be useful from a programming perspective to create an ordered list of index values. The WAIT command can be used to trap your touchscreen coordinates (bottom of https://www.hpmuseum.org/forum/thread-216.html has a framework that you might find helpful). So for example, if you divide the 320x240 screen into a 10x10 array (each "block" is 32x24 pixels), then the list should be ordered so that the first 10 index values correspond to the first row of blocks, the next 10 index values correspond to the second row, etc. The (x,y) coordinates from the touchscreen can be obtained from the WAIT command, and it should be a simple matter of integer division. Suppose your list is called IndexList. If n = floor(x/32)*10 + floor(y/24), then IndexList(n) should get you the desired index.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
12-28-2020, 11:08 PM
Post: #27
RE: Keeping graphic objects in programs
Dear Mr. Han,
Thank you very much for your response. However, it takes some programming, thinking and trying work, and therefore some time, to get started with your answer, so I ask you to be patient for now before answering you about the results. I will reply as soon as possible. Sincerely, Karel.

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
12-29-2020, 07:00 PM
Post: #28
RE: Keeping graphic objects in programs
(12-27-2020 11:43 PM)Han Wrote:  It may be useful from a programming perspective to create an ordered list of index values. The WAIT command can be used to trap your touchscreen coordinates (bottom of https://www.hpmuseum.org/forum/thread-216.html has a framework that you might find helpful). So for example, if you divide the 320x240 screen into a 10x10 array (each "block" is 32x24 pixels), then the list should be ordered so that the first 10 index values correspond to the first row of blocks, the next 10 index values correspond to the second row, etc. The (x,y) coordinates from the touchscreen can be obtained from the WAIT command, and it should be a simple matter of integer division. Suppose your list is called IndexList. If n = floor(x/32)*10 + floor(y/24), then IndexList(n) should get you the desired index.
Dear Mr. Han,
The first part with the .PNG files went well. As for the second part, I have to tell you that not the whole screen is used for the boxes. This means that there are also unused areas on the screen, which when pressed should actually give an error message in the form of a red circle with an exclamation mark. How much there is unused screen surface depends on the use of this app. This is why it all gets a bit more complicated with the calculation of the index value. With this I hope to have informed you sufficiently for now. Sincerely, Karel.

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: