B4A Library [Class] SearchView - More powerful alternative to AutoCompleteEditText

Status
Not open for further replies.

Smee

Well-Known Member
Licensed User
Longtime User
in main i also have this sub

B4X:
Sub InitProgressBar
   Dim rflBar As Reflector
   rflBar.Target = ProgressBar1
   rflBar.RunMethod2("setMax", pbIndexMax, "java.lang.int")
End Sub

which is called from

B4X:
Public Sub SetItems(Items As List) As Object
Main.pbIndexMax=Items.Size
CallSub(Main,"InitProgressBar")
 

Smee

Well-Known Member
Licensed User
Longtime User
i tried taking the conditional if out so the doevents is called every time but it made no difference.
the progressbar shows as a thin line
 

Smee

Well-Known Member
Licensed User
Longtime User
this is the code as it now stands

B4X:
Public Sub SetItems(Items As List) As Object
Main.pbIndexMax=Items.Size
CallSub(Main,"InitProgressBar")

   Dim startTime As Long 
   startTime = DateTime.Now
   'ProgressDialogShow2("Building index...", False)       remarked out
   Dim noDuplicates As Map
   noDuplicates.Initialize
   prefixList.Clear
   substringList.Clear
   Dim m As Map
   Dim li As List
   For i = 0 To Items.Size - 1
      Main.pbIndexMax=i
      CallSub(Main,"UpdateProgressBar")
      'If i Mod 100 = 0 Then                     remarked out
      DoEvents


B4X:
mAIN mODULE

Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim SQL As SQL
   Dim index As Object
   Dim pbIndexMax,pbCounter As Long
End Sub

Sub InitProgressBar
   Dim rflBar As Reflector
   rflBar.Target = ProgressBar1
   rflBar.RunMethod2("setMax", pbIndexMax, "java.lang.int")
End Sub

Sub UpdateProgressBar
   ProgressBar1.Progress= pbCounter
End Sub

tHE progressbar is built with designer and called ProgressBar1
 

Smee

Well-Known Member
Licensed User
Longtime User
Ok,
still not working

in Main Module i have created the following

B4X:
Sub timer1_Tick
   Timer1.Enabled=False
   LoadProductList
   BuildDisplayTable   
End Sub

the code in timer tick IS executed a second after Activity create is finished

Timer1.Enabled=True

B4X:
Public Sub SetItems(Items As List) As Object
Main.pbIndexMax=Items.Size
CallSub(Main,"InitProgressBar")

   Dim startTime As Long 
   startTime = DateTime.Now
'   ProgressDialogShow2("Building index...", False) remmed out
   Dim noDuplicates As Map
   noDuplicates.Initialize
   prefixList.Clear
   substringList.Clear
   Dim m As Map
   Dim li As List
   For i = 0 To Items.Size - 1
      If i Mod 100 = 0 Then DoEvents
      Main.pbIndexMax=i
      CallSub(Main,"UpdateProgressBar")

all i see on the screen is a thin line where the progressbar should be
i have set the size to massive in the designer
top 300
width 660
height 300
left 40
enabled=true
visible =true
indeterminate = False

i have put a stop line on the line
ProgressBar1.Progress= pbCounter
in main and it is executing.

i have put the progressbar on a panel but it still just shows as a thin line
 
Last edited:

Smee

Well-Known Member
Licensed User
Longtime User
I added another progressbar to the activity with the designer but i get the same thing. a thin line

I am posting a screenshot
 

Attachments

  • Screenshot_2013-01-21-22-28-45.jpg
    15.2 KB · Views: 422

Smee

Well-Known Member
Licensed User
Longtime User
might be better to email it. where can i send it
 

Smee

Well-Known Member
Licensed User
Longtime User
Ahh I see my problem there.

Ok I removed the Dim pbCounter As Long from Globals

And changed this
B4X:
            If i Mod 100 = 0 Then DoEvents
            Main.pbcounter=i
            CallSub(Main,"UpdateProgressBar")
            Dim item As String

So I now get a run of numbers correctly when logging.

However I still just get a thin line as if the height is about 5 dips high


12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
Index time: 11777 ms (12134 Items)
 

Smee

Well-Known Member
Licensed User
Longtime User
its impossible to see, but the counter ticks over ok

this sub fires correctly

B4X:
Sub UpdateProgressBar
   Log(pbCounter)
   ProgressBar1.Progress= pbCounter
End Sub

as you see from the log i posted
 

Smee

Well-Known Member
Licensed User
Longtime User
ok i have modified the original demo program to show what is happening
 

Attachments

  • test2.zip
    11.2 KB · Views: 385

Smee

Well-Known Member
Licensed User
Longtime User
Thanks Erel,

All that for a stupid mistake :BangHead:

The thing is i only added that after i found the program was not working. The original error was elsewhere, got fixed but still would not work cos i left that line in.

Is there a way to increase the height of the progressbar?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…