Author Topic: search box's [RESOLVED]  (Read 18496 times)

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
search box's [RESOLVED]
« on: October 22, 2010, 02:24:57 PM »
Hi,
In the BookHN example there are 4 search option. I have managed to hook up another 4 and get them to work. The problem is that its taking up way to much space.

I have now added a dropdown menu/popup and added the 8 options to it. Next to this i have added a new textfield followed by a button. Does anyone know how i can hook the dropdown list options to the textfield and button. Basicly i am trying to get the the dropdown and 1 textfield and button do the same job as 8 options, textfields and buttons. I have tried looking at the popup example but can't figure it out.

Thanks in advance for any help or examples of this
« Last Edit: October 27, 2010, 12:52:52 AM by tools-n-stuff »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: search box's
« Reply #1 on: October 22, 2010, 04:56:33 PM »
Hi

Here is a simple Popup menu holding 4 items - when selected the index number and selected item are put into 2 fields

(1) In the card script put the following code that will setup the Popup menu:-

Code: [Select]
local plist

Put 'Title' into plist
Put 'Author' after plist
Put 'Publisher' after plist
Put 'Comment' after plist

PopupSetText(1,plist)
PopupSetIndex(1,1)


(2) In the Popup menu script put the following code:-

Code: [Select]
Put PopupIndexFN(1) into field 1

Put PopupItemFN(1) into field 2

Best regards
Malcolm
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: search box's
« Reply #2 on: October 22, 2010, 08:52:56 PM »
Obviously i know less than i thought!

Thanks for getting me started in the right direction, but i think i am either lost or what i want can't be done.
Displaying the results as you showed below is not quite what i am trying to do.
When the user selects something from the list i don't want it to display anything, yet! On selection i want it to activate a textfield ready for search input. At this point the user can now search based on the dropdown choice. Only when the search button is pressed will the results be displayed in a final textfield.

I imagine you are familiar with the bookHM sample!!??

I basicly want to compress the actual search system into one. Replacing all the searchboxs with just one that is activated by choice through the dropdown menu. From there on in showing the clickable results as in the example.

After looking at the guide and playing around with the bookHN searchfield, i still can't work out how connect them up.
I can see it as being theoretically possible but know nothing about programming i can't figure out if its even possible.
Maybe i am barking up the wrong tree.

regards
Dayne
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: search box's
« Reply #3 on: October 22, 2010, 11:10:46 PM »
Hi Dayne

Don't be disheartened as you are certainly making progress. You just have to breakdown what you want into smaller steps.

Those buttons that carry out the search - they actually just pass 2 parameters to a global procedure called SearchFields.
The parameters are an integer that indicates which fields to search, and a word to search for.
So in the popup menu you could just use the index returned when the popup is pressed and send this index plus search term from popup to the SearchField procedure.

Just modify the previous code in the Popup menus script to:

Code: [Select]
Global searchIndex

@ Which field to search
Put PopupIndexFN(1) into searchIndex


Now you need an edit field to store the text to be searched for plus a button to carry out the seach,

If the field is number 2 then the search button script would be:

Code: [Select]
Global searchIndex
Local sword

Put field 2 into sword
Call SearchFields(searchIndex,sword)


I think this should work although I haven't tested it.

Best regards
Malkom
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: search box's
« Reply #4 on: October 23, 2010, 01:28:43 AM »
I must be really thick! :?

I have tried placing your code everywhere now, and i still can't get it to work.

Please tell me exactly what page of have to put the code on.

When you say:

Quote
(1) In the card script put the following code that will setup the Popup menu:-

Code: Select all
    local plist

    Put 'Title' into plist
    Put 'Author' after plist
    Put 'Publisher' after plist
    Put 'Comment' after plist

    PopupSetText(1,plist)
    PopupSetIndex(1,1)

Please, whats the card script?

Working on 'card 2' i clicked the background to select it and then on script in 'creator properties' displaying the yellow script editor. This has the 'Card' button pressed by default displaying a page with the following code
Quote
Global searchResults

Put searchResults into field 5

Call DisplayRecord
Do i place it here somewhere and if so where?
Or do i have to hit the 'MainCode' button and place it somewhere, and if so where?

You then said
Quote
(2) In the Popup menu script put the following code:-

Code: Select all
    Put PopupIndexFN(1) into field 1

    Put PopupItemFN(1) into field 2

Does 'Popup menu script' mean click on the dropdown menu in the designer and then on the script button and place the info there?  Obviously if i can get this part sorted out, the modified code you sent will replace this part, i think thats what you meant.

Also i have noticed that on quitting the application, stack or exe, that saved info isn't stored. I have tried moding the menu button and changing Quit to QuitSave(1) it now saves only the first Page of entries. Any thoughts on that.

Sorry if i need real laymans terms, while i get my head round it all.
and thanks again
Dayne
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: search box's
« Reply #5 on: October 23, 2010, 06:48:50 AM »
I think it would help you  a great deal to work through the Quick Start pdf.
The Quick Start introduces cards, their scripts, buttons etc and explains the difference between the MainCode section where startup and global procedures go - so very soon you'll know where everything belongs.

To place code in the Card script - just click on the card background then in the Properties toolbar select the Script button.
Code in the card's script runs once the card is opened so allowing you to initialize popups etc.

Best of luck.
Malkom
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: search box's
« Reply #6 on: October 23, 2010, 06:57:03 AM »
Sorry, i just remembered - the Quick Start pdf pictures are older and so don't show the same Script Editor layout as that in HyperNext V3 but the  MainCode section and cards etc still work the same way.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: search box's
« Reply #7 on: October 23, 2010, 03:38:13 PM »
Thats definatly sound advice, but i have always been a hands on person. I get stuck in and learn as i go and build!
I thought this was going to be easier than it looks and once again it looks like i'm wrong.

I did notice that i'd followed your advice and code correctly so, i can't see why it won't work.

I guess if i can handle another hello world lesson i may try and go through the guide. At this stage and so close to a final product, it seems my initial euphoria was a little short lived.

Thanks anyway
Dayne
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: search box's
« Reply #8 on: October 23, 2010, 07:59:53 PM »
Right i've got a general idea after going over the guide and somethings still not right.
Firstly the plist is only displaying the last option out of 8 leaving you without a choice.
Secondly the search part simply doesn't return results.

Obviously i need to read and learn (as you mentioned/suggested), but how many times do i read the guide before i give up.

For me this example doesn't work, and for you: You think it may work but you haven't tested it. (  :)  remind me not to buy a car from you)

As a user i can understand that you haven't the time to invest in noob non programmers, thats down to the software owners, (unless they don't really "understandably" care about their own "freeware" products)
I don't suppose you know of any other users or forums where i can find someone to help?

And thanks again.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: search box's
« Reply #9 on: October 24, 2010, 09:44:55 AM »
Quote from: "tools-n-stuff"
Right i've got a general idea after going over the guide and somethings still not right.
Firstly the plist is only displaying the last option out of 8 leaving you without a choice.
Secondly the search part simply doesn't return results.

As the plist is only displaying the last option out of the 8, I'm wondering if the plist does contain 8 items. Did you use the AFTER form of the PUT command for the subsequent options:-

Code: [Select]
Put **** after plist
Perhaps you could put the contents of plist into a field and see if they are what you expect:-

Code: [Select]
@ field needs to be multi-line
Put plist into field 3

Programmers spend much of their time debugging as things don't often work first time.
Using a combination of the Message command and dumping variables to fields should make your debugging much easier.

Code: [Select]
@ do something
....
....
Message var2
...
...
Message var1
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: search box's
« Reply #10 on: October 24, 2010, 06:15:34 PM »
Heh heh! Well spotted!

You are correct, after pasting my 4 other additions to the plist i forgot to change them from 'into' to 'after':
As for displaying the result, my bad, i forgot to tell the button where to display.
So basicly it works, except for one small thing that i have spent the last 2 hours trying to find.

The plist is not showing as a list but as one line of text.
I 'think' that it has something to do with this:

PopupSetText(1,plist)
PopupSetIndex(1,1)

I have tried changing values, removing one line at a time and even both. Yes there are changes each time but not the one i want.

I will go back now and try to work it out. I will come back and let you know if and when i get it to work.
Unless you manage to see this before i do and you have the solution.

cheers


TAKE 2:
Ok back again.
I have tried to put the plist into a firld as you suggested and it displays as a list, good.
But the drop down list is still showing as one line and not as a list!!??
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: search box's
« Reply #11 on: October 25, 2010, 01:34:43 AM »
I have spent the whole day going over the quick start and reference guide and i still can't get the list to show as a list. It continues to display as a single line of text.

I don't know if you read the post just before this one!? But basicly it works, but it will only search for the Title. I believe this is because the whole list is on one line and im hoping that when the list becomes a list it will allow a full search through all fields.

regards
Dayne
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: search box's
« Reply #12 on: October 25, 2010, 09:45:17 AM »
Quote from: "tools-n-stuff"
I have spent the whole day going over the quick start and reference guide and i still can't get the list to show as a list. It continues to display as a single line of text.

I don't know if you read the post just before this one!? But basicly it works, but it will only search for the Title. I believe this is because the whole list is on one line and im hoping that when the list becomes a list it will allow a full search through all fields.

The problem is to do with line-ending characters inside controls and that Macintosh Windows and Unix all have different line-endings  - there are some notes on this in the Help section on Strings.

if you modify the card's script to this:-

Code: [Select]
local plist,endline

Put 'Title' into plist
Put 'Author' after plist
Put 'Publisher' after plist
Put 'Comment' after plist

@ set line endings for Windows platform
Put EndLineFN(3) into endline
Put ReplaceEndsFN(plist,endline) into plist

PopupSetText(1,plist)
PopupSetIndex(1,1)
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: search box's
« Reply #13 on: October 25, 2010, 12:58:26 PM »
Thanks for that!
I have gone over the strings section in the guide but it only says what you can place. It doesn't help explain where and why, which is obviously what i need because your new addition to the code gives back an error message as follows:

  ^ Invalid destination
Put EndLineFN(3) into endline

I have once again tried to change a couple of things and at best i get an empty dropdown menu with space for a list of 2 lines. So i put the code back to the way you changed it.

Im sorry i can't get my head round this yet, i am used to HTML, 3DML and Flash(3DFA), and installing and themeing forums (phpbb, simplemachine etc)
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: search box's
« Reply #14 on: October 25, 2010, 03:15:55 PM »
Quote from: "tools-n-stuff"
Thanks for that!
I have gone over the strings section in the guide but it only says what you can place. It doesn't help explain where and why, which is obviously what i need because your new addition to the code gives back an error message as follows:

  ^ Invalid destination
Put EndLineFN(3) into endline

I have once again tried to change a couple of things and at best i get an empty dropdown menu with space for a list of 2 lines. So i put the code back to the way you changed it.

Im sorry i can't get my head round this yet, i am used to HTML, 3DML and Flash(3DFA), and installing and themeing forums (phpbb, simplemachine etc)

Did you remember to declare endline as a local variable?

About the String Help - i usually use the Built-In help via the menu bar as its much quicker than using the Language Reference PDF. Although both need updating. Unfortunately for newcomers to programming there are a lot of gotchas - like endofline chars - that experienced programmers hardly have to think about - its just a matter of building up experience.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

 

anything