I'm trying to write a standard routine for scaling the menu, which has not the bugs from that proposed in the manual the last hint form Per is perfect! thanks!
2016-08-10 0:01 GMT+02:00 pjwitte <pjwi...@online.no>: > On 06/08/2016 15:09, pjwitte wrote: > >> On 06/08/2016 13:13, Giorgio Garabello wrote: >> >> 2016-08-06 12:40 GMT+02:00 pjwitte: >>> >>> On 05/08/2016 01:23, Giorgio Garabello wrote: >>>> >>>>> >>>>>> When you draw a menu with Easymenu, that design is the minimum >>>>>> size of >>>>>> >>>>>>> the >>>>>>> menu. >>>>>>> I can not make it smaller by SBASIC, using MDRAW command. >>>>>>> Now, is there any way to read this minimum size of the menu? The >>>>>>> manual >>>>>>> I >>>>>>> could not find anything useful, but my English is bad and probably >>>>>>> escaped >>>>>>> me. >>>>>>> >>>>>>> Thanks in advanced >>>>>>> >>>>>>> Giorgio >>>>>>> >>>>>>> 2016-08-05 15:43 GMT+02:00 pjwitte: >>>>>>> >>>>>> >>>>>> Surely, the programmer who designed the menu already knows its >>>>>> minimum >>>>>> size? Or am I missing something? >>>>>> >>>>>> Per >>>>>> >>>>>> >>>>> On 05/08/2016 20:36, Giorgio Garabello wrote: >>>> > Not necessarily, in my case it is a service routine that must >>>> > be able to handle any menu >>>> > >>>> > Giorgio >>>> >>>> I use the same routine as Tobias to read the values directly from the >>>> working definition, eg after a resize call by the user. My point is >>>> that it >>>> seems pointless to calculate a value that is fixed and known in >>>> advance: A >>>> menu's minimum size is built into the menu presumably by the author >>>> of the >>>> program using it. I could only think of a few special cases, such as a >>>> utility, like my MenView, to display menu (_men) files, and >>>> programs for >>>> designing menus, such as EasyMen itself. But perhaps thats what you >>>> had in >>>> mind. No, matter, Im glad you found a solution! >>>> >>>> Per >>>> >>>> PS I sent this message last night - 9 hours ago - but it hasnt arrived >>>> yet, so trying again 12.39 GMT+2. Why so slow? P >>>> >>> >> My aim is to resize the menu without moving . >>> Using the routines that I found on the EASYPTR manual (or on the web ) >>> if I try to make it smaller over size its minimum , the menu shrinks >>> only up to its minimum size ( and is correct to do it ) and then moves >>> . >>> I have to overcome this drawback , the lower right corner should never >>> move, so I thought I calculate the new point of origin so >>> >>> X current source - current width + minimum width >>> >>> and >>> >>> source current Y - current height + minimum height . >>> >>> So i need to use the minimum size of the menu. I was hoping to get >>> poterve automatically . >>> >>> I'm using Google translate , so probably I am sending you the nonsense >>> .. or the recipe of spaghetti with tomato sauce ! >>> >>> Giorgio >>> >>> Well, then you need to PEEK the window definition [WD] rather than the >> window working definition [WWD]. EasyPtr prepends its own header to >> the WD. I think its always 28b long, in which case the >> standard/minimum size can be found at >> >> WD = APPA(<menu name>) >> minx = PEEK_W(WD + 28): miny = PEEK_W(WD + 30) >> >> This is not a universal formula, mind you, as more than one layout may >> be defined (the menu designer will know). However, I'll leave that as >> an excercise for now.. ;) Check out the excellent QPTR manual for >> details, and use EasySource to dissemble your EasyMen menus. >> >> Per >> > > This was not quite what Giorgio had in mind, as he doesnt use APPAn, but > the following construct (which I had forgotten about): > > MDRAW#ch; 'my_menu' > > ie MDRAW takes the menu name directly from an appended binary. The > solution then became: > > ch = fopen('con') > > rem Get the WD directly via the WWD > adr = mwdef(#ch): madr = peek_l(adr + 4) > xmin% = peek_w(madr): ymin% = peek_w(madr + 2) > > .. > mdraw#ch; 'my_menu',.. > > Arguments and provisos as previously noted. > > > Per > _______________________________________________ > QL-Users Mailing List > _______________________________________________ QL-Users Mailing List