Normal Topic Directory font size (Read 7398 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Directory font size
Apr 30th, 2018 at 9:12pm
Print Post Print Post  
I'm trying to make the font of my directory lists larger.  Is it possible to do so?  I'm using the following command:

@PopupChoiceList(directoryList,"SELECT A DOCUMENT TO VIEW")

I'd like all of these directory lists to have a larger font. Is there some setting that will increase the size?
  
Back to top
 
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Directory font size
Reply #1 - May 1st, 2018 at 1:04pm
Print Post Print Post  
It might be more technical but you could possibly create your own custom dialog box instead of using @PopupChoiceList.

You would probably need to use these commands somewhere in your code:

Code
Select All
#include "sbasic_include.sbas"
@OpenWindow
@AddWidget
WidgetAttribute
WIDGET_ATTR_TEXT_FONT_SIZE
 



  
Back to top
 
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Directory font size
Reply #2 - May 1st, 2018 at 2:58pm
Print Post Print Post  
I don't know how to set up a custom dialog box.   Would you show me what the programming would look like?
  
Back to top
 
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Directory font size
Reply #3 - May 1st, 2018 at 6:26pm
Print Post Print Post  
For this form you would have three LE's. A text field named "Selection", a command button named "Standard", and a command button named "Custom." Each button fills out the "Selection" text field with data selected from a list.

This is what it looks like: https://imgur.com/a/bgYLfjt



This is the event programming for the "Standard" command button On Element Entry:

Code
Select All
var vList as String
var vSelection as String

vList = "Sammy; Jenna; Rutherford; Clark; Stewey; Jimbo; Rayna"

vSelection = @PopupChoiceList(vList,"SELECT A DOCUMENT TO VIEW")

Selection = vSelection
 



This is what it looks like: https://imgur.com/a/vhCqPFp



This is the event programming for the "Custom" command button On Element Entry:

Code
Select All
#include "sbasic_include.sbas"

var vFont as Int
var vWindow as Int
var vWidget as Int
var vList as String
var vCount as Int
var vLoop as Int
var vResult as String

vFont = "18"
//Change vFont to whatever font size you want.

vWindow = @OpenWindow(300, 300, 265, 110, "Custom Choice List")
//Creates window. You can change the first two values to pick a
//different x/y positon where you want it to display.

vWidget = @AddWidget(1, 20, 20, 225, 25, "Select")
WidgetAttribute(vWidget, 3, vFont)
//Sets the "label font" of the accept button widget.

vWidget = @AddWidget(4, 20, 65, 225, 25, "")
WidgetAttribute(vWidget, 1, vFont)
//Sets the "text font" of the dropdown list widget.

vList = "Sammy; Jenna; Rutherford; Clark; Stewey; Jimbo; Rayna"
//Change vList to whatever you want your list to be generated from,
//such as, from a directory. You might have to use string array,
//directory, or list commands to do so.

vCount = @CountStringArray(vList)
For vLoop = 1 to vCount
WidgetAttribute(vWidget, 5, @AccessStringArray(vList, vLoop))
Next
//Loops through each item in the vList string array and makes a
//WidgetAttribute "option" for each item.

vResult = @RunWindow()
//Causes window to appear.

Selection = vResult
//Sends the list choice to the "Selection" field.
 



This is what it looks like: https://imgur.com/a/3Nd9vJK



As you can see, it runs a For Loop so that it can set a Widget Attribute for each individual item of your String Array list. This is neccesary, because when creating a dropdown list for @AddWidget you must create a seperate individual WidgetAttribute "option" for each item you want to be in the dropdown list.

Also, you may want to generate your list (vList) from a directory or something like that. In that case, you'll have to use some of the programming that you may already have set up to generate your list. I hope it helps.
  
Back to top
 
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Directory font size
Reply #4 - May 2nd, 2018 at 7:27pm
Print Post Print Post  
Thanks for the help.  I've modified the programming as below.  I'm now able to get to the window, use the pull down list and open the file I want from the list by clicking on the SELECT button.

I have a few questions.  My current programming requires two clicks to open the file.  The programming below requires four clicks to accomplish the same thing.  Is there a way to bypass the little window and go directly to the list?  Then, is there a way to activate the file open activity merely by clicking an item on the list?

Also, I noted the list extends below the screen.  Is there a way to limit the length of the window and have a scroll bar on the right side of the window? 

I fear my users will have a problem changing to this system without some improvements.

Any suggestions are greatly appreciated.

NHUser



#include "sbasic_include.sbas"

var vFont as Int
var vWindow as Int
var vWidget as Int
var vList as String
var vCount as Int
var vLoop as Int
var vResult as String
var DirectoryList as string
var vDCNumber as string
var vSortedList as string
var vShowList as string
var vTemp as Int



vFont = "18"
//Change vFont to whatever font size you want.

vWindow = @OpenWindow(300, 300, 265, 110, "Choice List")
//Creates window. You can change the first two values to pick a
//different x/y positon where you want it to display.




vWidget = @AddWidget(1, 20, 20, 225, 25, "Select")
WidgetAttribute(vWidget, 3, vFont)
//Sets the "label font" of the accept button widget.




vWidget = @AddWidget(4, 20, 65, 225, 25, "")
WidgetAttribute(vWidget, 1, vFont)
//Sets the "text font" of the dropdown list widget.

//-------------------------

     directoryList = @LocalListDirectory("F:/sesame Docs/TS DOC Training")
     
//      vShowList=@PopupChoiceList(DirectoryList,"SELECT A TRAINING PROGRAM TO VIEW")


//

vList = directoryList

//Change vList to whatever you want your list to be generated from,
//such as, from a directory. You might have to use string array,
//directory, or list commands to do so.

vCount = @CountStringArray(vList)

For vLoop = 1 to vCount
WidgetAttribute(vWidget, 5, @AccessStringArray(vList, vLoop))
Next
//Loops through each item in the vList string array and makes a
//WidgetAttribute "option" for each item.

vResult = @RunWindow()
//Causes window to appear.

vShowList = vResult


//Sends the list choice to the "Selection" field.


     If @Len(vShowList)>0
     {
           vTemp = @ASynchShell("F:\sesame docs\ts doc Training\"+vShowList)
     }



  
Back to top
 
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Directory font size
Reply #5 - May 8th, 2018 at 3:45pm
Print Post Print Post  
Figured out a better way to do this. Originally, I was thinking about how you could use Macros and what not to reduce your clicks. It doesn't seem there is an innate way in the sBasic programming/commands to just make an event occur, like to click a button or to select a choice in a layout element as if a user clicked it. However, I think there is another way that might work for you.

This form has three elements. A "Name" text LE (purely for example and saving test records), a "Selection_List" List Box LE, and a "Select" Command Button LE.

The "Selection_List" List Box LE has special formatting in that it's Look is changed to an "Up Box" and it's Label is set to blank, and it's Selection Layer is 2 (or any Layer that's higher than the other LEs that you want it to hover over). The other two LEs have their default formatting.

This is what it looks like: https://imgur.com/a/F8X7YGl



There are a few different event programming snippets to add for this form. Here they are below:

Selection_List :: On Form Entry
Code
Select All
Visibility(Selection_List, 0)
PopulateListElement(Selection_List, "")

//Sets the element to invisible and makes sure that it's populated as blank by default. 



Selection_List :: On Form Exit
Code
Select All
PopulateListElement(Selection_List, "")

//So that your form doesn't ask if you if you want to save a record
//that's been changed or not. And since you aren't using this list
//to actually save data but to rather make a selection you don't
//ever need a a selection to stay permaneant. 



Selection_List :: On Element Immediate Change
Code
Select All
var vListItem as String
var vOpenDoc as Int

vListItem = Selection_List

If vListItem > "" Then
{

	vOpenDoc = @ASynchShell("C:\Sesame2\Docs\" + vListItem)
}

Visibility(Selection_List, 0)
PopulateListElement(Selection_List, "")

//Any time you select a different item in the list it automatically sets that
//List Box element as whatever selection you made. Anytime this changes from
//blank it will run your code, which in this case, means it will open the file
//path. Immediately after running that bit of code it will reset the element to
//invisible and repopulate it as blank. Thus, acting similar to a regular popup
//choice list. This will only work in update mode as you're not actually changing
//anything in Search Mode, and I couldn't see what it's use would be in Add mode
//either.. 



Selection_List :: On Retrieve Spec Open
Code
Select All
Visibility(Selection_List, 0)
PopulateListElement(Selection_List, "")

//Makes sure the element is invisible and populated as blank in Search Mode. 



Select :: On Element Entry
Code
Select All
var directoryList as String

If @Mode() = 1
{
	Visibility(Selection_List, 1)
	directoryList = @LocalListDirectory("C:\Sesame2\Docs\")
	PopulateListElement(Selection_List, directoryList)
}

//Makes the selection list visible and finally populates it with the
//directory you want. Thus allowing you to make your selection choice.
//It's mportant to note that this button will only be ReadOnly(Writeable)
//in Update Mode.
 



Select :: On Form Entry
Code
Select All
If @Mode() = 1
{
	ReadOnly(Select, 0)
}
Else
{
	ReadOnly(Select, 1)
}

//Makes sure the "Select" button element is ReadOnly(Writeable) in Update Mode
//and ReadOnly(Grayed Out) in Add Mode. 



Select :: On Retrieve Spec Open
Code
Select All
ReadOnly(Select, 1)

//Makes sure the "Select" button element is only ReadOnly(Grayed Out) in Search Mode. 





This is what it looks like in Search or Add Mode: https://imgur.com/a/j1vwQs7

This is what it looks like when you click the Select Button in Update Mode: https://imgur.com/a/TVCkKOH



As you can see it solves all of your problems you originally had. You can place the List Box LE wherever you want in your form, even if it overlaps other elements, because if you set a higher selection layer it will hover over the other elements. It allows you to set any style and size of font you want for your text items. And it also innately and automatically has scroll bars. It also only requires two-clicks to open the document of your choice. The only downside that I've found is that I couldn't get it to show the selection I made for a a second or two before it actually opens the document. So, you will click an item but you will not actually see a visual signifier. You will simply see the document open and the list disappear. I tried using Loiter(1000) but it wouldn't work. As long as the other event programming was going to run it wouldn't show the List Box as having a selection ("blue highlighting of the text"). Anyways, I'm sure there's a workaround to make that work or to give some kind of visual or audio signifier that an item has been selected but at least this will make your code work for now.






  
Back to top
 
IP Logged