Recent Posts

Pages: 1 ... 7 8 [9] 10
81
Files / Save & Load Data from file
« Last post by LinesOfCodes on October 02, 2020, 10:58:59 AM »
Hello, I want to ask a question.
Does HyperNext support save/load data from the XML/JSON/Plain text file? Like, save a value of a variable(s), load value of a variable from a file, etc.
Because I want to save my program data and settings there.
82
Getting Started / Re: How to show an Image
« Last post by Malkom on October 01, 2020, 06:42:51 PM »
Hello, I want to know how to show an Image in my program.
But I don't know I should use Sprite or Canvas and I didn't know what script I have to use?
I already looked in Script reference but I'm still don't know what script I have to use to show an Image.
Please help me!
Personally I would use the Canvas over the Sprite because in most situations the canvas is more flexible and has more events.
Sprites worked best in HN 3.x but in HN 4.x there were some issues, especially with sprite movement on OS X.
By the way, HN5, will have fully working canvases before its sprite engine is finished.


CanvasImages

To load an image into a canvas from the project folder just use the CanvasLoad(canvas,filename,scaleflag) as below.

Setting the scaleflag to 1 will cause the canvas to fit the whole image into the canvas.  Otherwise it will be displayed at pixel to pixel scale so larger images will be hidden off canvas.

Code: [Select]
Local fname

Put 'Chrysanthemum.jpg' into fname
CanvasLoad(1,fname,1)

Also there is the CanvasLoadAbs(canvas,filename,scaleflag) command that expects a full file path to the image.

There is also the CanvasLoadAsk(canvas,filename,scaleflag) command that presents a dialog box so the user can locate the image file.


For more details see the Help section Files  - Graphics.




Canvas Drop Image

Its possible to drop an image onto a canvas but the canvas must have its image drop event enabled.
It can be enabled/disabled using the CanvasSetDrop(canvas,modeflag)
Modeflag 0 disables, while 1 enables.
By default canvas image drop is disabled.

Usually the CanvasSetDrop command is placed in the Card's opening event but could equally be placed in a button's script etc.

Code: [Select]
CanvasSetDrop(1,1)



Image Banks
HyperNext has a set of image banks allowing images to be stored, retrieved and loaded/saved to and from files. The images can also be used in sprite animations and copied to/from canvases. Each bank holds one image and the number of banks allowed is dicated by the memory available.

Images within the banks can be rotated and flipped. These commands are particularly useful for preparing output for the printer and for canvases.

Files used by image banks can be either local or absolute.  Usually it is best to use local files.

There are also two sets of commands for saving/loading images. One is for cross-platform use and the other for standard image formats such as jpegs, picts etc.
 
83
Getting Started / How to show an Image
« Last post by LinesOfCodes on October 01, 2020, 12:34:18 PM »
Hello, I want to know how to show an Image in my program.
But I don't know I should use Sprite or Canvas and I didn't know what script I have to use?
I already looked in Script reference but I'm still don't know what script I have to use to show an Image.
Please help me!
84
Development Progress / September 2020
« Last post by Malkom on September 30, 2020, 02:46:54 PM »
Here is a brief progress report on HN5 development for the month of September 2020.

The aim is to get the Chart demo project running inside HN5 Creator IDE.

The development is being carried out on a Windows 7 x64 machine with regular testing of HN5 on Linux(Lubuntu).

The development language is Free Pascal which should ensure HN5 will be able to run on a variety of Operating Systems, both newer and older versions. The main targets being Windows, OS X and Linux.


RUNTIME ENGINE

Most of the keywords and functions needed by the Chart project are now implemented.
Those remaining are mostly concerned with the GUI such as canvas, color picker etc.


HELP SYSTEM

This now loads and correctly displays a test HAC help file.
It uses self-contained Free Pascal code to ensure that it will be both cross-platform and not need external helper apps.

 

 

85
Getting Started / Re: How can I use Listbox?
« Last post by Malkom on September 27, 2020, 10:55:24 AM »
In these examples the listbox has the ID 1, and has 3 columns and 10 rows.

Before starting with a listbox its usually best to reset it because HN can remember the final structure from when the project was previously run in Creator.

Code: [Select]
ListboxDeleteAll(1)

A listbox can also be set up in the card's opening event so making it appear instantly.
When editing a card's script or its controls:
   The opening event is the first item in the leftmost column of the listbox entitled "Card".
   Any items listed after the card's opening event are all for for controls such as buttons fields etc,

Set a listbox to have 3 columns:
Code: [Select]
ListboxSetColumns(1,3)

Alternatively you could build a 3 column listbox having 10 rows using the ListboxBuild command:
Code: [Select]
ListboxBuild(1,10,3)




  • How can I set heading text?

Code: [Select]
ListboxSetHeading(1,1,'Title 1')
ListboxSetHeading(1,2,'Title 2')
ListboxSetHeading(1,3,'Title 3')



  • How can I Insert a value into the second column?

So to set the listbox cell column 2 and row 9, to value 'hello' use:
Code: [Select]
ListboxSetCellValue(1,9,2,'hello')



  • Can I run a command If the user double clicks on a row?

Your script can check for various listbox events using the function ListboxEventFN(id):

For instance, this code checks if a cell was clicked. When a cell is clicked, it finds the cell coordinates and then calls a user-defined procedure to do something.
Code: [Select]
Local event,row,col

Put ListboxEventFN into event
If event=2 then
    Put ListboxRowClickedFN(1) into row
    Put ListboxColumnClickedFN(1) into col   
    Put ListboxCellValueFN(1,row,col) into txt
    Call DoSomething(row,col,txt)
endif

Note, a listbox's script is only called in response to an event such as when the user clicks a cell, drops a file on it, etc.

Here are the event numbers and descriptions:
         1 - Cell action either editable cell or checkbox clicked.
         2 - Cell clicked.
         3 - Drag reorded rows.
         4 - Drag row.
         5 - Drop drag.
         6 - Drop file.
         7 - Double click.
         8 - Header pressed
         9 - Cell key down.
         10 - Cell got focus.
         11 - Cell text change.
         12 - Cell lost focus.
         13 - Sort column.




  • How to add more columns

The ListboxSetColumns(id,ncols) changes the number of columns, for instance to 5, in this code:
Code: [Select]
ListboxSetColumns(1,5)

Note, if you want to add a row use the ListboxAddRow(id,value) command.
It adds value into the first cell of the new row.
Code: [Select]
ListboxAddRow(1,'cell value')
86
Getting Started / Re: How can I use Listbox?
« Last post by Malkom on September 27, 2020, 09:54:39 AM »
I try reading "Language Reference 401.pdf" on the download page.
Now I know how to add a value into the second column by using the "ListboxSetCellValue bid, row, col, val" command
  • bid: Field ID
  • row: What row you want to insert a value
  • col: What column you want to insert a value
  • val: Message you want to be insert

Set Heading text by using the "ListboxSetHeading bid, col, val"
  • bid: Field ID
  • col: Column you want to set the heading
  • val: Text you want to set

Get the currently selected row by using the "ListboxIndexFN(1)" command
usage: Put ListboxIndexFN(1) into num

That's all I know for Today.

Thank you for partially answering your own questions and so helping others :)

I'll add some example code in the post below.



87
Getting Started / Re: How can I use Listbox?
« Last post by LinesOfCodes on September 27, 2020, 02:56:30 AM »
I try reading "Language Reference 401.pdf" on the download page.
Now I know how to add a value into the second column by using the "ListboxSetCellValue bid, row, col, val" command
  • bid: Field ID
  • row: What row you want to insert a value
  • col: What column you want to insert a value
  • val: Message you want to be insert

Set Heading text by using the "ListboxSetHeading bid, col, val"
  • bid: Field ID
  • col: Column you want to set the heading
  • val: Text you want to set

Get the currently selected row by using the "ListboxIndexFN(1)" command
usage: Put ListboxIndexFN(1) into num

That's all I know for Today.
88
Getting Started / How can I use Listbox?
« Last post by LinesOfCodes on September 26, 2020, 06:44:21 AM »
I want to use a Listbox but I don't know what command I have to type to use it the way I want.
I want to know:
  • How can I set heading text?
  • How can I Insert a value into the second column?
  • Can I run a command If the user double clicks on a row?
  • If HyperNext can't do the third one, then Can HyperNext script get the number of the row in the list that the user is selected?
  • How to add more columns

That's all I want to know.
89
General / Re: Documentation Improvement
« Last post by Malkom on September 21, 2020, 07:50:50 AM »
Hey, Developer.
Can you improve the HyperNext 4 Documentation? (Guide > Overview)
Because in HN4 Docs. It didn't explain everything. Such as didn't tell the meaning of parameters, Example of command usage, etc.
I know now, you're focusing on developing HN5 and will never add more features into this HN4 but please improve the documentation.

Thank you for your post as it has really helped clarify things.

A big problem with updating the inbuilt HN4 guide is that its made using a text to binary parser that is quite primitive, has bugs, and is tedious to use. I wrote it nearly 20 years and never got around to fixing it.

I'll do my best to answer any questions posted here. Topics here help other HN users and they'll probably make their way into the HN5 help.

Please feel free to ask any questions, although often any code I'll provide will only be brief snippets.


HN5 Help

The HN5 help is based on that in HAC(HyperNext Android Creator). HAC's was much better than HN4 as it was friendlier, using a CHM file that supported links and images, and had a better index. However, HAC used the external MS Windows CHM viewer utility.

HN5's inbuilt help system can already load the HAC help CHM file, display it, and is searchable. It works cross-platform as it use Free Pascal code.

The process of converting HN4 help text into a CHM file for HN5 is now underway.  lt is being updated, and improved with suggestions from previous posts here, and will available for download as help for HN users.

By the way, it looks easy to add some new HN commands so users can display their own CHM help files etc in HN5.


Note, I'm using a HelpNDoc to create the CHM and PDF files. They is also have fully functional free version available (for non commercial use only).


90
General / Documentation Improvement
« Last post by LinesOfCodes on September 19, 2020, 07:45:57 AM »
Hey, Developer.
Can you improve the HyperNext 4 Documentation? (Guide > Overview)
Because in HN4 Docs. It didn't explain everything. Such as didn't tell the meaning of parameters, Example of command usage, etc.
I know now, you're focusing on developing HN5 and will never add more features into this HN4 but please improve the documentation.
I'm telling you about this because I don't want to bother you in this forum much.
So you can be focusing more on HN5 without worry that I will ask you about command usage.

I know I'll ask more questions in the future. Like "How can I ...", "Can HyperNext do this?", etc.
But Improving documentation will make me understand how can I use that command without bothering you.

I hope you'll see this and fixing the documentation.
Pages: 1 ... 7 8 [9] 10