GUI in purely GLBasic

Previous topic - Next topic

Belnivista

a few more to follow for project nicha.
every worthwhile project takes time, sometimes even a lifetime

Belnivista

just a little more to follow then done :nw:
every worthwhile project takes time, sometimes even a lifetime

Belnivista

just one more to go  :giveup:
every worthwhile project takes time, sometimes even a lifetime

Belnivista

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:
every worthwhile project takes time, sometimes even a lifetime

Quentin

what's the problem with INSTR function?

Belnivista

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!!!
every worthwhile project takes time, sometimes even a lifetime

Quentin

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.

Belnivista

Thank you Quentin. Will do
every worthwhile project takes time, sometimes even a lifetime

Belnivista

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. :(
every worthwhile project takes time, sometimes even a lifetime

Quentin

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

Belnivista

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:
every worthwhile project takes time, sometimes even a lifetime

Belnivista

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
every worthwhile project takes time, sometimes even a lifetime

Quentin

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.

Belnivista

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
every worthwhile project takes time, sometimes even a lifetime

Quentin

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?