Alpha Video Training
Results 1 to 16 of 16

Thread: How to set the width of a browse, and keep it set.

  1. #1
    Member
    Real Name
    Russ Rowton
    Join Date
    May 2011
    Location
    Oklahoma City
    Posts
    29

    Default How to set the width of a browse, and keep it set.

    I have designed several custom browses that aren't very wide. When I am in design mode, I set the right side of the browse far enough in to show just the columns I want, with no white space to the right. However, when I run the browse, it usually opens up in full screen width. Sometimes it does, sometimes it opens as I set it. I can find no way to define exactly how wide the browse should be and have it open the same way every time.
    As I recall, a form has an option to set it's opening location to "current location and size", or something like that. I can find no similar feature for the custom browse.

    Any clues?

  2. #2
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,212

    Default Re: How to set the width of a browse, and keep it set.

    Have you tried to set object values using the Object Explorer?
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  3. #3
    Member
    Real Name
    Russ Rowton
    Join Date
    May 2011
    Location
    Oklahoma City
    Posts
    29

    Default Re: How to set the width of a browse, and keep it set.

    Quote Originally Posted by Mike Wilson View Post
    Have you tried to set object values using the Object Explorer?
    Thanks, Mike, for your response.

    No, I have not tried setting the width via the object explorer. I shall do that.

    russ rowton

  4. #4
    Member
    Real Name
    Russ Rowton
    Join Date
    May 2011
    Location
    Oklahoma City
    Posts
    29

    Default Re: How to set the width of a browse, and keep it set.

    OK, Mike, I tried (and found) where to set the width via the Object Explorer. So I set it. The current width as displayed was 453. I saved the work, ran the browse, it opened at 1351, way to heck off to the right. I reset it to 453, it immediately closed to the desired width, saved it, reran it, guess what? It opened way off to the right again, about three times wider than what I saved it.

    What good is the property setting if it won't remember or obey it? There must be some other way to get there.

    russ

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to set the width of a browse, and keep it set.

    Code the oninit event for the browse

    :browse_name.width = 453
    :browse_name.height = desired height

    Substituting the actual browse_name.

  6. #6
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,403

    Default Re: How to set the width of a browse, and keep it set.

    Stan's is the easiest way, however embedding a Browse in a Form retains the saved size I believe.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  7. #7
    Member
    Real Name
    Russ Rowton
    Join Date
    May 2011
    Location
    Oklahoma City
    Posts
    29

    Default Re: How to set the width of a browse, and keep it set.

    Quote Originally Posted by Stan Mathews View Post
    Code the oninit event for the browse

    :browse_name.width = 453
    :browse_name.height = desired height

    Substituting the actual browse_name.

    Stan, thanks for your time and your response.

    I entered the xbasic as suggested. Exactly. It didn't work.
    I have now discovered (unless I am hallucinating) that a browse opens precisely at the width of the LAST BROWSE OPENED. It doesn't matter what one sets in the properties, or with xbasic, the width of the next browse opened is exactly the width of the last browse opened.
    Can this be true?

    I may have to go with Ted Gile's suggestion and embed the browse in a form... it gives me some extra capabilities, as well.
    I just can't believe what I am seeing with the changes in the browse settings.

    For now, I shall go to the embedded browse. However, I have several long (read 'wide') browses, that open too short, if the last browse opened was a short (narrow) one.

    Thanks, once more, for your time to read and respond. russ r

  8. #8
    Member
    Real Name
    Russ Rowton
    Join Date
    May 2011
    Location
    Oklahoma City
    Posts
    29

    Default Re: How to set the width of a browse, and keep it set.

    Ted, thanks for your help.

    Please see my response to Stan Mathews suggestion.

  9. #9
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,403

    Default Re: How to set the width of a browse, and keep it set.

    Rus, have you thought about splitting the Browse content and using Tabbed Objects?
    Example;
    A browse would go over 1½ screens.
    Create Form with two Tabs
    Browse items 1-10 say. Tab Label = "Demoghaphics"
    Browse items 11-30 say. Tab Label = "Data/Information"
    If you want an example, just holler.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  10. #10
    Member
    Real Name
    Russ Rowton
    Join Date
    May 2011
    Location
    Oklahoma City
    Posts
    29

    Default Re: How to set the width of a browse, and keep it set.

    Thanks, Ted, for your reply.

    No, I haven't considered that option. Right now, that would be a little above my pay grade to even think of doing that. But I shall consider it.

    I really am using this project to learn how to use xbasic. Nearly everything I have ever developed in A5 has always had to have xbasic to get done exactly what I wanted done. "Click and Choose" goes a long, long way as Alpha has matured this software, but I just haven't encountered anything yet that did not call for an xbasic solution.

    For this project, I probably will go the way you suggested earlier and use an embedded browse on a form. That way I can do several other options using buttons.
    What I am trying to say is: "this browse thing is not a life or death matter", I was just surprised to discover that it operated in this manner, and that there is seemingly no "click on this" option to solve it. But now I know. I am especially surprised that using Stan's xbasic code did not solve it. I am not convinced that there is not still some overriding condition that prevents the xbasic code from working. If xbasic won't solve it, what will???

    On to more discoveries.... russ rowton

  11. #11
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: How to set the width of a browse, and keep it set.

    Quote Originally Posted by databaser View Post
    Thanks, Ted, for your reply. No, I haven't considered that option.
    I am not convinced that there is not still some overriding condition that prevents the xbasic code from working. If xbasic won't solve it, what will???
    The posts here often reflect the view that standalone browse has really no real place in a system. In my view its a bit like giving a user Excel as a viewer, when you can, as you already noted, very easily produce a controlled result with all the trimmings.

  12. #12
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,403

    Default Re: How to set the width of a browse, and keep it set.

    The attached took 5 mins. It really could not be simpler.
    I'm the opposite to you in that I will avoid Xbasic as much as I can.
    Attached Files Attached Files
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  13. #13
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,644

    Default Re: How to set the width of a browse, and keep it set.

    This works for me..

    oninit event

    topparent.Height =200
    topparent.Width =300

    -unless I maximize another form or browse and then all of the windows are maximized.....
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  14. #14
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,711

    Default Re: How to set the width of a browse, and keep it set.

    I couldn't get it to work either. If I opened any browse, resized it and then opened another browse; the size was relevant to the last resizing even from a different browse. Closing them all and opening the one I set the height and width from the control panel went back to the default size despite the OnInit event setting. This seems to be a problem more with a narrow browse than a wider one. Because the wider one without any OnInit size settings, did remember its previous size after closing and reopening.

    Edit:
    Calling the browse with a modified genie script did make a difference however:

    Code:
    DIM layout_name as c 
    layout_name = "COA List"
    DIM tempP as p
    'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
    tempP=obj(":"+object_Name_normalize(word(layout_name,1,"@")))
    'Test if pointer is valid
    if .not. is_object(tempP) then  
       tempP = :Browse.load(layout_name)   
       tempP.show() 
    end if 
    tempP.width = 500
    tempP.height = 500
    tempP.window_position("left","top")
    tempP.activate()
    Last edited by MoGrace; 10-29-2011 at 04:33 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  15. #15
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,711

    Default Re: How to set the width of a browse, and keep it set.

    I modified 2 functions I use to call a browse from a button. Here is the one that fetches the last record by default:

    Code:
    FUNCTION vw_brw AS L (brw_name as C,xwidth as N = 850,yheight as N = 640,xpos as c = "Left",ypos as c = "Top" )
    	DIM brw as P
    	brw = obj(":"+object_Name_normalize(word(brw_name,1,"@")))
    	IF .not. is_object(brw) THEN
    		brw = :browse.load(brw_name)		
    	END IF
    	if xwidth > 0 then
    	    brw.width = xwidth
    	end if
    	if yheight > 0 then
    	    brw.height = yheight
    	end if
    	brw.window_position(xpos,ypos)
    	brw.restrict_enter = .t.	
    	brw.activate()
    	brw.fetch_last()
    END FUNCTION
    Usage:
    This uses the default position but sets the width and height
    vw_brw("COA List",500,500)

    I have another one that will use "fill","fill" for larger browses so I don't have to maximize them, and it works with my docked global custom toolbar that reduces the fill viewing area.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  16. #16
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,711

    Default Re: How to set the width of a browse, and keep it set.

    Searching for this thread reveals that this problem has been an issue for a long time! Getting a saved browse to retain its width and height set in design mode does not work in the OnInit event for the browse - but does in the OnFetch event. However the trick is to only do this once else it will resize on every record change. But since the OnFetch follows the OnInit event when the browse is loaded, a global flag can be set to .t. in the OnInit event and set to .f. by a UDF that actually resizes the browse.

    Here are my steps:
    First create the UDF below: brw_size() and save it
    Open the saved browse in design mode and make it the size you want
    Open the IW and check its width and height properties
    ?your_browse_name.width
    ?your_browse_name.height

    Open the OnInit and OnFetch events for the browse in the editor

    Type this line in the OnInit event and save to the Code Library
    dim global brw_flag as L = .t.

    In the OnFetch use the function to set the size from the IW
    brw_size(360,600)

    Code:
    FUNCTION brw_size AS L (xwidth AS N, yheight AS N )
    	'use in OnFetch event for browse to resize one time only
    	'set the global brw_flag to .t. in OnInit event
    	topparent.window_position("Left","Top")  'this is my preference
    	DIM GLOBAL BRW_FLAG AS L
    	if brw_flag then
    		topparent.width = xwidth
    		topparent.height = yheight
    		BRW_FLAG = .f.
    	end if
    	brw_size = brw_flag
    END FUNCTION
    I am working on a form to keep track of my development notes and wanted to be able to pop up a layout, script, table or udf to see its detail. And the browses were the most annoying when I wanted to see one or two at the same time.
    Attached Images Attached Images
    Last edited by MoGrace; 02-07-2012 at 04:32 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

Similar Threads

  1. How to Set tab Width
    By forskare in forum Application Server Version 10 - Web/Browser Applications
    Replies: 3
    Last Post: 02-18-2011, 11:20 PM
  2. Set Field Width?
    By Keith Hubert in forum Application Server Version 9 - Web/Browser Applications
    Replies: 8
    Last Post: 01-08-2009, 08:51 AM
  3. Can you summerise a table and set the field width?
    By rmssoftware in forum Alpha Five Version 8
    Replies: 3
    Last Post: 03-26-2007, 09:52 AM
  4. Replies: 5
    Last Post: 11-29-2006, 01:34 PM
  5. Set Excel Column Width
    By Melvin Davidson in forum Alpha Five Version 5
    Replies: 1
    Last Post: 04-18-2003, 01:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •