Source language: Translate to:

Tabs and Conditions

General questions about NeoBook

Moderator: Neosoft Support

Tabs and Conditions

Postby krackerjaxz » Sat Oct 10, 2015 6:12 pm

I'm working with the npwUtility plugin. in particular, I'm using the tab control feature. I've been able to create three tabs as I want. Now my goal is to actually populate the tabs with objects. I have looked around but have yet to find any documentation on the plugin, therefore, I'm winging it. Thus far, I figured that I would have to do every action on my own. That is, if x-tab is the current tab then to show the objects that I want for the tab and then hide the other ones.

The issue I've run in to is that I can't seem to find any condition for objects. If I create an action in the timer to where the current tab equals "Tab 1" then it would show "Text1." If the current tab does not equal "Tab 1" then it will hide "Text1." I'm using the While condition. Unfortunately, that's causing a major loop cycle. The tabs seem to flicker. I would like to create a conditional statement to where if the current tab is "Tab 1" AND "Text1" is not visible, then it would hide it. Unfortunately, I don't know of a way to get the condition of an object in NeoBook.

Also, if there's a better way to go about doing this in the tabs then please let me know. I'm all ears.
krackerjaxz
 
Posts: 42
Joined: Sun Nov 24, 2013 8:58 am

Re: Tabs and Conditions

Postby HPW » Sat Oct 10, 2015 11:18 pm

Hello,

I think you mean hpwUtility.
It is a graphical helper-compnent to manage the visual border of a tab control.
It does not act as a container object for other objects.
See demo hpwTabControl.pub
There you see that the tabcontrol is placed on the masterpage and is behind each page.
The tabchange Event switches the pages and the visible objects of each page.
When you want to use it not that way, you would have the hide/show all wanted objects in that event.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Tabs and Conditions

Postby krackerjaxz » Sun Oct 11, 2015 8:57 am

Thanks for the clarification. I was under the impression that it was a container type object. I've created my tabs. I'm having difficulty with the OnChange action. It doesn't let me have three sets of statements. I've looked over the TabControl2.pub example and am trying to base my design in a similar fashion. Basically, I'm trying to use the OnChange action so that if the first tab is selected, it goes to the appropriate page. If the second tab is selected, it goes to the appropriate page. Unfortunately, when I add If statements in the OnChange action edit area, it removes almost all of it. I have something like this:

Code: Select all
If "Rect1_TabName" "=" "[#34]Tab 1[#34]"
GotoPage "Page 1"
EndIf

If "Rect1_TabName" "=" "[#34]Tab 2[#34]"
GotoPage "Page 2"
EndIf

If "Rect1_TabName" "=" "[#34]Tab 3[#34]"
GotoPage "Page 3"
EndIf


After clicking "OK" I go back to see what it kept. All it kept was "If"
krackerjaxz
 
Posts: 42
Joined: Sun Nov 24, 2013 8:58 am

Re: Tabs and Conditions

Postby HPW » Sun Oct 11, 2015 10:40 pm

Hello,

In the action editor of the command wizard it should look like this:

Code: Select all
If "[Rect1_TabName]" "=" "Tab 1"
GotoPage "Page 1"
EndIf

If "[Rect1_TabName]" "=" "Tab 2"
GotoPage "Page 2"
EndIf

If "[Rect1_TabName]" "=" "Tab 3"
GotoPage "Page 3"
EndIf


The code line on create should look like this:

Code: Select all
hpwTabControlCreate "Rect1" "Page1|Page2|Page3|Page4|Page5" "tpTop" "tsTabs" "" "50" "1" "If [#34][#91]Rect1_TabName[#93][#34] [#34]=[#34] [#34]Tab 1[#34][#13][#10]GotoPage [#34]Page 1[#34][#13][#10]EndIf[#13][#10][#13][#10]If [#34][#91]Rect1_TabName[#93][#34] [#34]=[#34] [#34]Tab 2[#34][#13][#10]GotoPage [#34]Page 2[#34][#13][#10]EndIf[#13][#10][#13][#10]If [#34][#91]Rect1_TabName[#93][#34] [#34]=[#34] [#34]Tab 3[#34][#13][#10]GotoPage [#34]Page 3[#34][#13][#10]EndIf[#13][#10]"


You could also use Rect1_TabIndex for the conditions.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Tabs and Conditions

Postby krackerjaxz » Sun Nov 29, 2015 9:46 pm

Thanks a lot for the help. For the most part I've gotten it working. However, I've encountered an error. When I go from the first tab to the second tab, I get an error saying that "Registration Settings" page doesn't exist. In my app, I have three pages. One page for each tab. I have no clue why it's saying the page is "Registration Settings." The page in the code is "Reg Settings" The error says that issue occured on line six. This is the code produce in the error:

Code: Select all
If "[Rect1_TabName]" "=" "Branding Settings"
GotoPage "Branding Settings"
EndIf

If "[Rect1_TabName]" "=" "Registration Settings"
GotoPage "Registration Settings"
EndIf

If "[Rect1_TabName]" "=" "Updater Settings"
GotoPage "Updater Settings"
EndIf


The actual code for the first tab/page is:

Code: Select all
If "[Rect1_TabName]" "=" "Branding Settings1"
GotoPage "Brand. Settings"
EndIf

If "[Rect1_TabName]" "=" "Registration Settings"
GotoPage "Reg Settings"
EndIf

If "[Rect1_TabName]" "=" "Updater Settings"
GotoPage "Updater Settings"
EndIf


When the error pops up, I click the "Edit Script" button, but it says I can't do that because the code was generated by a plugin. How can the plugin create its own code (see first set of code)?
krackerjaxz
 
Posts: 42
Joined: Sun Nov 24, 2013 8:58 am

Re: Tabs and Conditions

Postby HPW » Mon Nov 30, 2015 9:05 am

Not sure what you do where:

But your code in first snippet says:
Code: Select all
GotoPage "Registration Settings"


So when that page soes not exist it throws the error.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Tabs and Conditions

Postby krackerjaxz » Mon Nov 30, 2015 9:09 am

That's the problem. The code in the first snippet is not code I wrote. The code I wrote is in the second snippet. When the error occurs, it shows the code in the first snippet, of which Neobook is stating that the code was generated by a plugin. When I try to click on "Edit script" it doesn't allow me as it was code generated by a plugin. I have no idea how it generated that code in the first snippet as I never wrote that code.
krackerjaxz
 
Posts: 42
Joined: Sun Nov 24, 2013 8:58 am

Re: Tabs and Conditions

Postby HPW » Mon Nov 30, 2015 9:56 pm

Hello,

The Debugger must get the code from your app.
So open the Pub with a Texteditor and search for the strings. You should find the object which contains the code.

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Tabs and Conditions

Postby krackerjaxz » Wed Dec 02, 2015 8:01 am

Thanks for the suggestion. I should have thought to see if the code of the project file was in plain text. I did find the issue and corrected it. Now all is working fine with the tabs.
krackerjaxz
 
Posts: 42
Joined: Sun Nov 24, 2013 8:58 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 1 guest