Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Hatus
Partner - Creator II
Partner - Creator II

Change textbox size within macro condition

Hello everybody!

I am researching a possibility to create a progess bar in QlikView. The basic idea is to change a textbox width depending on how far my macro has worked.

When you place the code for resizing in a condition, the changes in the interface occures after the macro has completely run.

How can I change something in the interface sumultaneously during the macro is running?

Example:


sub testProgressBar

set textBox = ActiveDocument.GetSheetObject("TX01")
set frame = textBox.GetFrameDef
pos = frame.Rect

strIterable = ""

for i = 0 to 10000
strIterable = strIterable & " " & i

if i = 3000 then
pos.Width = 350
textBox.SetFrameDef frame
end if
next

end sub


Thanks for your suggestions

Regards

1 Solution

Accepted Solutions
Hatus
Partner - Creator II
Partner - Creator II
Author

Hi,

I have solved the problem:

In VBScript exists a function which pauses the code flow until the actualizations have been done. I.e. ActiveDocument.GetApplication.WaitForIdle must be placed after a "refresh" in the interface.

for i = 0 to 10000
strIterable = strIterable & " " & i

if i = 3000 then
pos.Width = 350
textBox.SetFrameDef frame
ActiveDocument.GetApplication.WaitForIdle

end if
next

Aquele abraço

View solution in original post

6 Replies
Hatus
Partner - Creator II
Partner - Creator II
Author

Hi,

I have solved the problem:

In VBScript exists a function which pauses the code flow until the actualizations have been done. I.e. ActiveDocument.GetApplication.WaitForIdle must be placed after a "refresh" in the interface.

for i = 0 to 10000
strIterable = strIterable & " " & i

if i = 3000 then
pos.Width = 350
textBox.SetFrameDef frame
ActiveDocument.GetApplication.WaitForIdle

end if
next

Aquele abraço
Hatus
Partner - Creator II
Partner - Creator II
Author

Hi

I have solved the problem:

In VBScript exists the function ActiveDocument.GetApplication.WaitForIdle , it must be placed after a change in the interface. Doing it he code flow is paused and the refresh is done 😉


Hatus wrote:for i = 0 to 10000
strIterable = strIterable & " " & i

if i = 3000 then
pos.Width = 350
textBox.SetFrameDef frame
ActiveDocument.GetApplication.WaitForIdle
end if
next


Aquele abraço

Hatus
Partner - Creator II
Partner - Creator II
Author

Hi

I have solved the problem:

In VBScript exists the function ActiveDocument.GetApplication.WaitForIdle , it must be placed after a change in the interface. Doing it he code flow is paused and the refresh is done 😉


Hatus wrote:for i = 0 to 10000
strIterable = strIterable & " " & i

if i = 3000 then
pos.Width = 350
textBox.SetFrameDef frame
ActiveDocument.GetApplication.WaitForIdle
end if
next


Aquele abraço

Hatus
Partner - Creator II
Partner - Creator II
Author

Hi

I have solved the problem:

In VBScript exists the function ActiveDocument.GetApplication.WaitForIdle , it must be placed after a change in the interface. Doing it he code flow is paused and the refresh is done 😉


Hatus wrote:for i = 0 to 10000
strIterable = strIterable & " " & i

if i = 3000 then
pos.Width = 350
textBox.SetFrameDef frame
ActiveDocument.GetApplication.WaitForIdle
end if
next


Aquele abraço

Hatus
Partner - Creator II
Partner - Creator II
Author

Hi

I have solved the problem:

In VBScript exists the function ActiveDocument.GetApplication.WaitForIdle , it must be placed after a change in the interface. Doing it he code flow is paused and the refresh is done 😉


Hatus wrote:for i = 0 to 10000
strIterable = strIterable & " " & i

if i = 3000 then
pos.Width = 350
textBox.SetFrameDef frame
ActiveDocument.GetApplication.WaitForIdle
end if
next


Aquele abraço

marcelo_7
Creator
Creator

Hi,

I'm also looking to find a solution on how to make a textbox resize in macro to make a progress bar. Had problems with docunits and conversion. This post gave me the answer:

http://community.qlik.com/message/60704#60704

I only needed the part:

tblrect.Width = 120

tbl.SetRect(tblrect)

Thought I would share, hope it helps!