Skip to main content

Posts

Embed GUI Inside Your Go Code

Embed Gui (HTML) Inside Go code  In every application, you are going to need HTML for your GUI. Now it's not a good idea to put your HTML file with your executable.  Using an HTML file for GUI has two major disadvantages:  Your guy is loading from HTML file so you have to be sure about the location of your HTML file. Your HTML code is now reachable to end user with which they can play. So Safer option is to embed your HTML inside your go program. You can do this with two ways, first is go with go-rice like tools which actually makes single executable consisting of your every resource file ( which consist your HTML, CSS and even images!, but I have not used it so have no more idea about it ) The second way to embed HTML is to write your HTML inside your code as a string.  To make it more clearly see the example below. Golang File main.go package main import ( "fmt" "github.com/sciter-sdk/go-sciter" "github.com/sciter-sdk/go-sciter/window" ) f...

Process Input Grabed From TIScript in Golang

process golang input in sciter In the real-world scenario, you have to get input from the user via GUI and then have to pass it down to go code for the further process. For example, let's say you are just creating a simple to-do app which takes the input of task and then stores it in the SQLite table which is handled by go code. In that case, you have to take data from the user using HTML and sciter and then have to pass that data to go code. Though the upper scenario is more real, we will go with a very simple example [ as still, we are in earlier stages ]. We will take two integer inputs from the user and then send those inputs to go function that will show the response given by code in the GUI over a label. First Lets See a working demo  Main goal of this post is to show you use of  ' view  ' in TIScript and ' DefineFunction ' function in GoLang File. So let's see the GUI File First.  GUI File First of all we will setup our input elements to get integers (...

Get Input In TIScript with sciter-sdk

What if you can not get input from the user in your application. This example is to show you how you can get user input from TIScript and process it with TIScript. Yes processing input on GUI Side. GUI File Making basic HTML layout with use of sugar syntax supported by sciter. I am using sciter syntax over defult HTML which also supported by sciter because its more consice and provieds more functionality like, we can define type of data input should accept on the tag itself so we don't have to do any datatype converions later on in TIScript.  Input tag is to get input while we will listen for click action on button. So lets just define HTML first. <html>     <head>                <style>                   </style>     </head>     <body>        <h1>Simple Input</h1>        ...

First Program With TIScript and Sciter Sdk

TIScript and Golang I am showing a very simple example of TIScript. By the way it, not an official intro. I will give more details on TIScript in future posts. This post is just to show you a simple demo of TIScript. It's like Hello TIScript GUI File In this example, I am introducing something new in HTML file instead of the Golang file so, focus here. So let's start with basic HTML that has just two elements an < H1>  tag say press button and other is the button with id btn1 main.html <html>     <head>                <style>                   </style>     </head>     <body>        <h1>Press Button</h1>            <!-- You can use this sugar syntax           To define id use '#[id]' instead of 'id=[id]'       ...

Setup Sciter sdk for golang on windows

setup sciter sdk on windows I am just showing how to setup SDK on windows. [ It's not required I know, as it's quite easy , But this blog will look incomplete without this. So, If you know how to setup it Please move on to next post .] I am blindly following this GitHub page ( of course will give screenshots as I do that step) https://github.com/sciter-sdk/go-sciter So let, follow  Download the   sciter - sdk    And extract it ( click on the link ) Download and extract sciter-skd Extract the sciter runtime library from   sciter - sdk   to system PATH Copy sciter runtime to system path Just to go get from terminal to get the go-sciter library on your local machine go get -x github.com/sciter-sdk/go-sciter That's it 

Hello Sciter Program

Hello sciter program As we are used to doing a hello world program for learning a new programming language or any framework. In Sciter for GUI, you have to use web stacks [ means HTML/CSS] to create a UI of the application. Either you can bind HTML inside your go code or you can create a separate HTML file for it. In some starting examples, we will go with a separate HTML file to make things easy to understand. Easy thing first let start with GUI of the application as its just a simple HTML file So here is the HTML file of [ GUI File ] Of the Application  GUI FILE  Hello.html <html>     <head>         <title>Harmony</title>         <!-- style definitions -->         <style>             h1{                 text-align: center             }         <...