Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamically add/delete pages on a pageframe
Message
 
À
29/12/2003 16:23:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00862578
Message ID:
00862703
Vues:
14
I'm probably on wrong track as usual, but can you add a dummy page so you have room to play with pageorder?

nick


>Ok, now how to change the pageorder to reorder the pages if necessary? There must be a way to do it? You cannot change the pageorder value to a value that is already used by another page and you cannot change it to something higher than the pagecount, so the below doesn't work:
>
>DIMENSION pagename(5,2)
>pagename(1,1) = "appscrn1.spr"
>pagename(2,1) = "appscrn2.spr"
>pagename(3,1) = "appscrn3.spr"
>pagename(4,1) = "appscrn4.spr"
>pagename(5,1) = "appscrn5.spr"
>FOR i = 1 TO ALEN(pagename,1)
>	pagename(i,2) = i
>ENDFOR
>
>DODEFAULT()
>i = 1
>WITH THIS.PageFrame1
>  i = 1
>  lnitem = 0
>  DO WHILE i <= .pagecount
>    lnitem = ASCAN(pagename,.objects(i).name)
>    IF lnitem = 0
>      	.REMOVEOBJECT(.objects(i).name)
>    ELSE
>      *--There already is a page 3 so the below will not work if
>      *--linitem is 3
>      *--The page whose pageorder value is 3 now will be changed
>      *--to another value but we haven't gotten there yet
>      .objects(i).pageorder = lnitem  && error - this pageorder value is already used of course
>      i = i + 1
>    ENDIF
>  ENDDO
>ENDWITH
>RETURN .T.
>
>
>Any ideas?
>
>
>>I have figured out that for now (until someone comes up with a better idea) if I make the name property of the page in the pageframe match the dos screen that was used to create that page, I can store the name of the page I want to include (which is already done in the dos version) in the pagename array and then I can remove those I don't want included by doing something like:
>>
>>
>>*--Example Only
>>*--Array of pagenames to include in the pageframe
>>DIMENSION pagename(5,2)
>>pagename(1,1) = "appscrn1"
>>pagename(2,1) = "appscrn6"
>>pagename(3,1) = "appscrn3"
>>pagename(4,1) = "appscrn4"
>>pagename(5,1) = "appscrn5"
>>
>>DODEFAULT()
>>i =1
>>WITH THIS.PageFrame1
>>  DO WHILE i <= .pagecount
>>    IF ASCAN(pagename,.objects(i).name) = 0
>>      	.REMOVEOBJECT(.objects(i).name)
>>    ELSE
>>      i = i +1
>>    ENDIF
>>  ENDDO
>>ENDWITH
>>RETURN .T.
>>
>>
>>for now anyway.
>>
>>
>>>I am still in the process of converting some older FPD26 Dos screens and have done quite a few multi-page forms so far. However, we have some dos screens that were created somewhat differently. The read was handled outside the screen and screen pages were loaded into an array depending on certain conditions so that screens were created dynamically as so:
>>>
>>>
>>>*--Not a realworld example but it shows the logic of building the array
>>>*--in the old FPD26 Dos APP:
>>>DO CASE
>>>CASE ag_state = "NC" and ag_type = "FULL"
>>>  pagescreen(1)="screena.spr"
>>>  pagescreen(2)="screenb.spr"
>>>  pagescreen(3)="screenc.spr"
>>>CASE ag_state = "SC" and ag_type = "FULL"
>>>  pagescreen(1)="screena.spr"
>>>  pagescreen(2)="screenf.spr"     &&(replaces screenb as the 2nd screen)
>>>  pagescreen(3)="screenc.spr"
>>>  pagescreen(4)="screend.spr"     &&(this screen added)
>>>CASE ag_state = "NC" and ag_type = "NON"
>>>*etc...
>>>ENDCASE
>>>
>>>*--Determine the last page of the application
>>>pageend = ALEN(pagescreen,1)
>>>
>>>*-- The editpage procedure shows the appropriate screen on the page and
>>>*--tracks the keystroke to determine if the pages should cycle up or down
>>>*--(pageup or pagedwn pressed) etc.
>>>
>>>Do editpage
>>>
>>>*etc.
>>>
>>>
>>>I have been adding screens to the forms I've converted so far as pages in a pageframe successfully, however, that does not solve the problem of creating a dynamic page order. The page order would be set initially and would not change during the session at all. It would be dependent on the values of some public variables that will already be set. Any ideas how best to handle this? In the forms I have done so far I have added code in the form's keypress event to check the active page and set the focus appropriately so the focus is never on the pagetab but on the first control on the page if the user pressed pagedown (or exited the last control on the previous page) and on the last control of the page if the user pressed pageup from the next page in the sequence, etc.
>>>
>>>First, I will need to drop and add pages as necessary so that I only have one form created for all cases and the unused pages do not even show up in the pageorder or tabs. Next I will need to be able to determine which control I should set focus to on the page depending on which page is displayed as page2 for example. I guess for the 2nd issue I could just always name the control frstcontrol or something so that I could always set focus to the first control on the page no matter the actual page displayed and lastcontrol for the last control on the page, etc. However, what about the first issue of adding/dropping pages in a pageframe? Is there a good way to do it?
>>>
>>>TIA,
>>>tracy
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform