GLBasic forum

Main forum => Beta Tests => Topic started by: Belnivista on 2018-Dec-14

Title: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
a few more to follow for project nicha.
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
just a little more to follow then done :nw:
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
just one more to go  :giveup:
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
this following file needs to be called :   nicha_settings.ini
media files .ini  and .txt in project folder like normal created glb project. there should be no problems in loading and compiling.

my question is around the native instr function. if theres anyone that is willing to help me, It will be greatly appreciated! i have hit a mind block because of a instr function.
:noggin:
Title: Re: GUI in purely GLBasic
Post by: Quentin on 2018-Dec-14
what's the problem with INSTR function?
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
Hi,
Where I made the function in the Ttable type to search the array it works when I search by department but not the rest. I am not currently at the computer to reply with the exact location of my function, but will do later in the afternoon when I get home. You are more than welcome to download everything have a look, even improve and use. I need the program done by end of January,  but got stuck with my search function.

I made an spreadsheet array that accepts the searched array values, but only the one gets searched everytime. In the point of sale you need to be able to search the stock array to get a grouping by category. The same search function works great when i used it on the spreadsheet page to calculate stock prices etc, but it just dont want to work when I use it in this one instance.


I hope i explained good enough... as i said, i get home later and can go through it in more details.


Thanks!!!
Title: Re: GUI in purely GLBasic
Post by: Quentin on 2018-Dec-14
I also need to wait until evening for testing. Would be good if you can provide a small example, under which circumstances INSTR is not working correctly.
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
Thank you Quentin. Will do
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
hi,
i tried getting as much as possible info to show the problem. please ask if something is not clear enough. it helps finally asking someone in the know for assistance. i am the only person doing programming between my friends and fam. :(
Title: Re: GUI in purely GLBasic
Post by: Quentin on 2018-Dec-14
hmmm, guess it will be hard to find without a working example.
I tested INSTR function with some examples and everything looks good.

Did you already try a DEBUG output within this function?

e.g.
Code (glbasic) Select

FUNCTION search_table_partial:start,c,param$
LOCAL row = -1,length = BOUNDS(self.contents[],0) - 1,ins = -1
IF start < length
FOR i = start TO length
DEBUG "search: " + param$ + " - search for: " + self.contents[i][c].sval$ + "\n"
ins = INSTR(param$,self.contents[i][c].sval$)
IF ins > -1
row = i
RETURN i
BREAK
ENDIF
NEXT
RETURN row
ENDIF
RETURN -1
ENDFUNCTION
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
how can i give you a working example? i literally joined this morning, so i have no idea how to give a working example. :nw:
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
mmmmmmmm  not reaaaaally sure how to use the debug. sorry. i have done 100s of glb projects (usually gui`s started from scratch), but never actually used all the available stuff in glb. dead serious now
Title: Re: GUI in purely GLBasic
Post by: Quentin on 2018-Dec-14
I guess everything is included in the project folder of your app. Just zip it and try to upload it here in the forum.

Did you already try the debug option? Good way to check the values of the variables within the faulty working function. You'll have to activate the debug mode in the "Compiler" menu though.
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
i hope its compressed correctly.

usually what i do is print all values to screen and figure out where the problem lies, but this time its with the instr not working as far as I can tell. have been struggling with this issue now the past week or so
Title: Re: GUI in purely GLBasic
Post by: Quentin on 2018-Dec-14
I'm able to compile your application, anyhow I don't know how to create the data needed for tests.

One thing I'm worrying about:

your command
Code (glbasic) Select
ins = INSTR(param$,self.contents[i][c].sval$)

Are you sure, you're using the parameters for INSTR function correctly in this case? I guess that "param$" is the string you're searching for and "self.contents[]" is the data in which you want to find "param$".

If this is the case, you're command should look like:
Code (glbasic) Select
ins = INSTR(self.contents[i][c].sval$,param$)

The first parameter of INSTR is the string you want to investigate, the second parameter is the string you're looking for.
Perhaps you can try it this way.

by the way ... amazing application, what is it intended to do?
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
 :x
sorry, you are correct. THANK YOU!!!!!!
i must have miss looked that in frustration. you just saved me a LOT of brain itching.

this is a POS that im doing for my business out of a mix between hobby and necessity. the GUI is because i just like doing it and dont understand the stuff available. 10 years ago i made a similar program only simpler( it works flawlessly and still in use), but now i need a better one with more features. previous on has barcode printing, accounts, till slip printing and selling screen(point of sale). this one will have financial data, stock data, business data labour costing... etc. basically a proper point of sal program thats going to be fully free and up there with the best of them.
=D it all started with a what if, and is nearing completion now. i will definitely put it out for all to use, was my intention all along, cuz i`ve read reviews and  stuff and glb needs a proper GUI to be growing some more


thanks Quentin for your help!
Title: Re: GUI in purely GLBasic
Post by: dreamerman on 2018-Dec-14
In shorts, I've checked code, and if I undersand correctly You are using InStr in wrong way, in GLBasic it's:
Code (glbasic) Select
pos% = INSTR(where_to_look$, what_you_want_to_find$, start%=0)
so it should be:
Code (glbasic) Select
ins = INSTR(self.contents[i][c].sval$,param$)
in 'search_table_partial' function and that's working... despite that I would advise to declare variables as integers %, by default they are float #..

ah.. @Quentin was faster :]
data is already there, yet at least I've some problem with fonts - solid black background, properly visible only after hover/focus.
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
thanks dreamerman!
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
@ dreamerman

can you elaborate about the fonts please? anything to improve will do wonders
Title: Re: GUI in purely GLBasic
Post by: Quentin on 2018-Dec-14
glad we could help :) It's an often made mistake, even after years of programming, so don't worry much about it.

by the way ... welcome to the forum


regarding the font I have the same problem as described by dreamerman. Every menu entries/input fields and so on are black colored unless hover over it with mouse pointer (see attachment)
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
thats to do with the font files then.

make sure the
SETTRANSPARENCY RGB(255,0,128)

and there sould be 2x font files. i did attach it in previous posts. it happens alot when i test programs on other computers.

sometimes the settransparency wont work properly( it might be me as stated  =D)
Title: Re: GUI in purely GLBasic
Post by: Belnivista on 2018-Dec-14
Thanks guys!!

this is how it should look though. working correctly
Title: Re: GUI in purely GLBasic
Post by: SnooPI on 2019-Feb-14
Very very interesting project (in purely GLBasic so very portable)

I hope you're still working on it, it's really good  :good:
Title: Re: GUI in purely GLBasic
Post by: MrPlow on 2019-Mar-04
Nice one!!

I too am using GLB for some business side projects...here is the start of my simple grid data viewer - but your GUI project looks very nice!

What are you using for your database backend?

Title: Re: GUI in purely GLBasic
Post by: Kitty Hello on 2019-Mar-09
Cool stuff. I just wonder, what is wrong with using DDgui instead?